June 02, 2009

add switch in bash script


case $1 in
1)
echo "1"
;;
2)
echo "2"
;;
*)
echo "default"
;;
esac


$1: first argument

Ref: http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2004-04/0466.html

No comments: