while [ $# -gt 0 ]; do
case $1 in
-h|--help)
print_help
exit 0
;;
-V|--version)
print_version
exit 0
;;
-l|--listen)
listening_address=$2
shift 2
;;
-p|--port)
lipo=$2
shift 2
;;
-P|--protocol)
proto=$2
shift 2
;;
-v|--verbose)
verbose=true
shift
;;
--)
shift
break
;;
*)
echo "Internal Error: option processing error: $1" 1>&2
exit 1
;;
esac
done
shell多參數處理技巧
MarK下,以備後用shell編程,難免會碰到多參數,多參數處理技巧如下:轉自:http://jonny131.iteye.com/blog/581016
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.