Unix Shell Script Case Statement
May 15, 2007 by Mark Marucot
The case statement is similar to if .. else if .. else statement which performs specific statement/s if there are three or more conditions.
Syntax:
CODE:
-
case word in
-
value1) statements
-
value2) statements
-
…
-
*) statements
-
esac
Example:
CODE:
-
!#/bin/sh
-
case $1
-
in
-
1) echo ‘First Choice’;;
-
2) echo ‘Second Choice’;;
-
*) echo ‘Other Choice’;;
-
esac




Comments
Feel free to leave a comment...
and oh, if you want a pic to show with your comment, go get a gravatar!