You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionparse_params() {
# -allow a command to fail with !’s side effect on errexit# -use return value from ${PIPESTATUS[0]}, because ! hosed $?! getopt --test > /dev/null
if [[ ${PIPESTATUS[0]}-ne 4 ]];then
script_exit 'I’m sorry, `getopt --test` failed in this environment.' 2
fi
OPTIONS=chno:v
LONGOPTS=cron,help,no-color,output:,verbose
# -regarding ! and PIPESTATUS see above# -temporarily store output to be able to check for errors# -activate quoting/enhanced mode (e.g. by writing out “--options”)# -pass arguments only via -- "$@" to separate them correctly! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")if [[ ${PIPESTATUS[0]}-ne 0 ]];then# e.g. return value is 1# then getopt has complained about wrong arguments to stdout
script_exit "Argument error" 2
fi# read getopt’s output this way to handle the quoting right:evalset -- "$PARSED"local param
...
The text was updated successfully, but these errors were encountered:
Feeding back a more radical change than the prior suggestions in PR #8 and issue #9.
What I now have in my
template.sh
:From memory, I iterated from this blog source and this gist.
The text was updated successfully, but these errors were encountered: