MarK下,以备后用shell编程,难免会碰到多参数,多参数处理技巧如下:转自:
http://jonny131.iteye.com/blog/581016
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

4589

被折叠的 条评论
为什么被折叠?



