Re:Shell Script Best Practices, from a decade of scripting t...
by lbhdc on Thursday October 27, 2022 @12:00PM
(#33359555)
In the example I gave I wouldn't write that in a script file, so I would just alter the command itself.
If I wanted to parse cli args I would use case on the input to mux out the args. I personally prefer writing cli interfaces this way (when using a scripting language).
while test $# -gt 0; do
case "$1" in
-f|--flag) shift; FLAG="$1";;
esac
shift
done
If I wanted to parse cli args I would use case on the input to mux out the args. I personally prefer writing cli interfaces this way (when using a scripting language).