Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Shell scripting with passing arguments

$
0
0
Hi All,

I am using the script for creating local queue and passing the arguments while running the script as below

Code:

n=0
while [ $n -lt $1 ]
do
e=`expr $n + 3`
echo 'DEFINE QL('$e') MAXDEPTH('$6') MAXMSGL('$7') DEFPSIST('$8') '$9'' | /apps/mqm_opt/bin/runmqsc $2
n=`expr $n + 1`
done

Running the script
Code:

./sample.sh 3 QueueManager1 Q1 Q2 Q3 5000 4194304 NO
3 - Number of queues to be created
QueueManager1 - name of the queue manger
Q1 - Queue 1 to be created
Q2 - Queue 2 to be created
Q3 - Queue 3 to be created
5000 - Maxdepth of queue
4194304 - Size of message in queue
NO - Queue persistence
<null> - Cluster

In the above highlighted, the value should be either $3, $4, $5 based on the condition from "for loop" but the script takes the queue name as 3,4,5 instead of Q1,Q2,Q3 respectively.

I am not sure how the variable should be passed inside "DEFINE QL()"

Can someone please help on this.

Thanks,
Anusha

Viewing all articles
Browse latest Browse all 16232

Trending Articles