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
堆積各式雜物
case $1 in
1)
echo "1"
;;
2)
echo "2"
;;
*)
echo "default"
;;
esac
No comments:
Post a Comment