|
|
|
|
|
by Spivak
2170 days ago
|
|
You can do that it will just make things a little less pretty. while (( $# )); do
case "$1" in
-*h*|--help)
do_help
exit
;;
-*v*|--version)
do_version
exit
;;
-*d*|--debug)
debug=true
;;&
-*a*|--arg)
value="$2"
shift
;;&
esac
shift
done
It doesn't support args of the form -avalue but those a pretty uncommon anyway. |
|
You could
Putting the option stuck together to its value has the advantage of working nicely with brace expansion. For example, you can call `strace -p{1111,2222,3333}` to trace those 3 pids and avoid having to type `-p` 3 times.