We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tested on alpine:latest
PS: I don't like the idea of copy & paste from some ksh script
The text was updated successfully, but these errors were encountered:
--- a/syslog-redirect.in +++ b/syslog-redirect.in @@ -20,25 +20,6 @@ esac pdie() { echo "$0: ERROR: ${1-}" 1>&2; exit "${2-1}"; } -getopts_want_arg() -{ - if [[ $# -lt 2 ]]; then - pdie "Option requires an argument: $1" - fi - if [[ -n ${3:+set} ]]; then - if [[ $2 =~ $3 ]]; then - : OK - else - pdie "Invalid value for option: $1: $2" - fi - fi - if [[ -n ${4:+set} ]]; then - if [[ $2 =~ $4 ]]; then - pdie "Invalid value for option: $1: $2" - fi - fi -} - help_p= while [[ $# -gt 0 ]]; do @@ -67,7 +48,13 @@ while [[ $# -gt 0 ]]; do exit 0 ;; --log-level) - getopts_want_arg "$opt" ${1+"$1"} '^[0-7]$' + if [ $# -lt 2 ]; then + pdie "Option requires an argument: $opt" + fi + case $1 in + [0-7]) ;; + *) pdie "Invalid value for option: $opt: $1";; + esac SYSLOG_REDIRECT_LOG_LEVEL="$1"; shift export SYSLOG_REDIRECT_LOG_LEVEL ;;
Sorry, something went wrong.
No branches or pull requests
tested on alpine:latest
PS: I don't like the idea of copy & paste from some ksh script
The text was updated successfully, but these errors were encountered: