Operating System - HP-UX
1826312 Members
4395 Online
109692 Solutions
New Discussion

Re: Shell Scripting: case command

 
SOLVED
Go to solution
Nikee Reddy
Regular Advisor

Shell Scripting: case command

Hello,

Here I am attaching some of the lines from one of the script file.

case $returncode in
0) echo " Instance on host $LOCAL_HOST started" | tee -a $LOGFILE;;
1) echo " Instance already running" | tee -a $LOGFILE;;
*) echo " Startup of Instance failed" | tee -a $LOGFILE
printf " See $LOGFILE for details\n\n";;
esac


I would like to include the following line with in the case command under value 0. i.e. if the $returncode value is 0 the folllowing command line should also get executed.

/oracle/PRD/TransLink30/verrfc -averrfc -gorion -xsapgw00 & >> $LOGFILE 2>&1

Thanks,
Nikee
2 REPLIES 2
Sridhar Bhaskarla
Honored Contributor
Solution

Re: Shell Scripting: case command

Hi Nikee,

I didn't understand your question well.

Doesn't the following work?

case $returncode in

0)

echo " Instance on host $LOCAL_HOST started" | tee -a $LOGFILE

/oracle/PRD/TransLink30/verrfc -averrfc -gorion -xsapgw00 & >> $LOGFILE 2>&1

;;

1)

..

;;

etc

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Charlie Rubeor
Frequent Advisor

Re: Shell Scripting: case command

Unless I misunderstand the question, it would look like this:

case $returncode in
0) echo " Instance on host $LOCAL_HOST started" | tee -a $LOGFILE
/oracle/PRD/TransLink30/verrfc -averrfc -gorion -xsapgw00 & >> $LOGFILE 2>&1;;
1) echo " Instance already running" | tee -a $LOGFILE;;
*) echo " Startup of Instance failed" | tee -a $LOGFILE
printf " See $LOGFILE for details\n\n";;
esac