The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using variable in case statement fialia Shell Programming and Scripting 2 05-12-2008 01:54 AM
case statement bkan77 Shell Programming and Scripting 5 09-11-2007 02:54 PM
Logical AND within a case statement ?? hcclnoodles Shell Programming and Scripting 1 11-10-2006 11:27 AM
Case Statement Zeta_Acosta Shell Programming and Scripting 19 04-06-2004 01:16 PM
case statement Bab00shka Shell Programming and Scripting 1 07-15-2002 02:31 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-19-2007
Registered User
 

Join Date: Nov 2007
Posts: 9
sh -help with case statement (should be simple)

I'm having an issue running multiple commands in a case statement. If i only run one command it works fine. Am I supposed to use double semi-colons after each statement or do i not need any at all?

here is a snippet of the code:

case `uname` in
"Linux")
echo This is linux.
cat $BODY | mail -s "$SUBJECT" email@domain.com
echo useradd $USERID -c \"$USERNAME\"
#useradd.orig $USERID -c "$COMMENT"
;;
"SunOS")
echo This is sun.
cat $BODY | mailx -s "$SUBJECT" email@domain.com
echo useradd $USERID -c \"$USERNAME\"
#useradd.orig $USERID -c "$COMMENT"
;;
"SCO_SV")
echo This is sco.
cat $BODY | mail -s "$SUBJECT" email@domain.com
echo useradd $USERID -c \"$USERNAME\"
#useradd.orig $USERID -c "$COMMENT"
;;
*)
echo Sorry I do not recognize that OS."
;;
esac

thanks

Last edited by kuliksco; 11-19-2007 at 07:03 PM.
Reply With Quote
Forum Sponsor
  #2  
Old 11-19-2007
Registered User
 

Join Date: Nov 2007
Posts: 9
ugh look like i missed a " above the esac. I got it working!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0