diff options
author | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2007-03-20 03:05:53 +0000 |
---|---|---|
committer | Bo Ørsted Andresen <bo.andresen@zlin.dk> | 2007-03-20 03:05:53 +0000 |
commit | 69aeb5e269ee0d7c9dffb11489899b7011d46e1c (patch) | |
tree | 2584ae0bf1ff00765c5b4d3b93eda55c64e81f76 | |
parent | c3b5542f7248dcf73677d52a69a3989c519c8022 (diff) | |
download | wgetpaste-69aeb5e269ee0d7c9dffb11489899b7011d46e1c.tar.gz |
Fix -- handling. Die on unrecognized options.
-rwxr-xr-x | wgetpaste | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -8,13 +8,14 @@ VERSION="2.1" ### helper functions +# print multiple lines print() { for arg in "${@}"; do echo -e "${arg}" done } -# show an error message and die +# show error message(s) and die die() { print "${@}" 1>&2 exit 1 @@ -374,6 +375,9 @@ get_filename() { while [[ -n "${1}" ]]; do case "${1}" in + -- ) + shift && get_filename "${@}" && break + ;; -c | --command ) [[ -z "${2}" ]] && no_argument "${1}" SOURCE="command" @@ -450,8 +454,8 @@ while [[ -n "${1}" ]]; do SOURCE="xcut" shift ;; - -- ) - shift && get_filename "${@}" && break + -* ) + die "${0}: unrecognized option \`${1}'" ;; *) get_filename "${1}" && shift |