diff options
-rwxr-xr-x | anondcim | 30 |
1 files changed, 11 insertions, 19 deletions
@@ -32,23 +32,17 @@ file_prefix="" dst_size="1280" dst_dir="" -while getopts ':p:s:d:' OPTION -do +while getopts ':p:s:d:' OPTION; do case $OPTION in - "p") - file_prefix="${OPTARG}" - ;; - "s") - dst_size="$OPTARG" - ;; - "d") - # enforce a trailing "/" - [ -d "${OPTARG%/}/" ] && dst_dir="${OPTARG%/}/" || die "destination directory \"${OPTARG%/}/\" does not exist" - ;; - *) - err "not recognised: OPTION=$OPTION, OPTARG=$OPTARG" - die_usage - ;; + "p") file_prefix="${OPTARG}";; + "s") dst_size="$OPTARG";; + "d") # enforce a trailing "/" + [ -d "${OPTARG%/}/" ] && dst_dir="${OPTARG%/}/" \ + || die "destination directory \"${OPTARG%/}/\" does not exist" + ;; + *) err "not recognised: OPTION=$OPTION, OPTARG=$OPTARG" + die_usage + ;; esac done shift $(($OPTIND - 1)) @@ -56,8 +50,7 @@ shift $(($OPTIND - 1)) cur=1 total=$# -for fn in "$@" -do +for fn in "$@"; do if [ -z "$dst_dir" ]; then # use the directory of the source file dst="$(dirname "$fn")/" @@ -105,4 +98,3 @@ EOF cur=$(($cur + 1)) done - |