From f4ecc799acc812f82d1112fbd6aec16460763476 Mon Sep 17 00:00:00 2001 From: Jan Huwald Date: Wed, 5 Nov 2014 15:58:28 +0100 Subject: get destination directory using `dirname` instead of string handling diff --git a/anondcim b/anondcim index 44dacf2..aa4902b 100755 --- a/anondcim +++ b/anondcim @@ -30,7 +30,7 @@ which jhead 2>/dev/null || which exiftool 2>/dev/null || die "jhead or exiftool # set default values file_prefix="" dst_size="1280" -dst_dir="--same--" +dst_dir="" while getopts ':p:s:d:' OPTION do @@ -58,10 +58,9 @@ total=$# for fn in "$@" do - if [ "$dst_dir" = "--same--" ] - then - # if the filename contains a "/" then use this dir - [ "$fn" != "${fn%/*}" ] && dst="${fn%/*}/" || dst="" + if [ -z "$dst_dir" ]; then + # use the directory of the source file + dst="$(dirname "$fn")/" else dst="$dst_dir" fi -- cgit v0.10.1