The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-19-2007
kuliksco kuliksco is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 10
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 10:03 PM..