LQ Newbie
Registered: Mar 2010
Posts: 1
Rep:
|
Probem with case statement in shel programing
Hi Friends,
I am facing problem with the following script. Could you please look into this.
echo 'Enter Staging number'
case $STGNUM in
1)
for i in {'stg1-greg','stg1-marsha','stg1-peter','stg1-jan','stg2-greg','stg2-marsha','stg2-peter','stg2-jan'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/workflow/stopwf.sh;done;
for i in {'stg1-greg','stg2-greg'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/wfjmssf/stopwfjms.sh;done;
for i in {'stg1-greg','stg2-greg'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/wfjmssf/runwfjms.sh;done;
for i in {'stg1-greg','stg1-marsha','stg1-peter','stg1-jan','stg2-greg','stg2-marsha','stg2-peter','stg2-jan'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/workflow/runwf.sh;done;
3)
for i in {'stg3-greg','stg3-marsha','stg3-peter','stg3-jan','stg4-greg','stg4-marsha','stg4-peter','stg4-jan'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/workflow/stopwf.sh;done;
for i in {'stg3-greg','stg4-greg'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/wfjmssf/stopwfjms.sh;done;
for i in {'stg3-greg','stg4-greg'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/wfjmssf/runwfjms.sh;done;
for i in {'stg3-greg','stg3-marsha','stg3-peter','stg3-jan','stg4-greg','stg4-marsha','stg4-peter','stg4-jan'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/workflow/runwf.sh;done;
7)
for i in {'stg7-greg','stg7-marsha','stg7-peter','stg7-jan','stg8-greg','stg8-marsha','stg8-peter','stg8-jan'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/workflow/stopwf.sh;done;
for i in {'stg7-greg','stg8-greg'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/wfjmssf/stopwfjms.sh;done;
for i in {'stg7-greg','stg8-greg'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/wfjmssf/runwfjms.sh;done;
for i in {'stg7-greg','stg7-marsha','stg7-peter','stg7-jan','stg8-greg','stg8-marsha','stg8-peter','stg8-jan'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/workflow/runwf.sh;done;
9)
for i in {'stg9-greg','stg9-marsha','stg9-peter','stg9-jan','stg10-greg','stg10-marsha','stg10-peter','stg10-jan'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/workflow/stopwf.sh;done;
for i in {'stg9-greg','stg10-greg'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/wfjmssf/stopwfjms.sh;done;
for i in {'stg9-greg','stg10-greg'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/wfjmssf/runwfjms.sh;done;
for i in {'stg9-greg','stg9-marsha','stg9-peter','stg9-jan','stg10-greg','stg10-marsha','stg10-peter','stg10-jan'};do echo $i; ssh $i sudo -u dev /opt/usr/apps/workflow/runwf.sh;done;
*)
echo "entered wrong staging no"
esac
Error:
[suga@stg7-greg workflow]$ dev ./Test1.sh
Enter Staging number
./Test1.sh: line 9: syntax error near unexpected token `)'
./Test1.sh: line 9: `3)'
Thanks,
U.Srinivas
|