5 January 2012

UNIX shell script to show the use of case statement

$ cat>caseexa.sh
#! /bin/sh
echo “Enter a command (who or 1s)”
read command
case “$command” in
who)
echo “Running who….”
who
; ;
1s)
echo “Running 1s….”
1s
; ;
*)
echo “Bad command”
; ;
esac
exit 0

0 comments:

Post a Comment