From: fpunktk Date: Sat, 30 Dec 2017 11:26:31 +0000 (+0100) Subject: use dirname instead of string handling X-Git-Url: https://fpunktk.de/gitweb/?p=anondcim.git;a=commitdiff_plain;h=59df44445e51b871aa0bda81880533433f45cb35 use dirname instead of string handling --- diff --git a/anondcim b/anondcim index 027ccc6..feae766 100755 --- a/anondcim +++ b/anondcim @@ -73,11 +73,12 @@ do # if [ "$dst_dir" = "--same--" ] then - # if the filename contains a "/" then use this dir - [ "$fn" != "${fn%/*}" ] && dst="${fn%/*}/" || dst="" + # use the directory of the source file + dst="$(dirname "$fn")/" else dst="$dst_dir" fi + # # always use a padded number as destination filename suffix dst_jpg="$dst$file_prefix$(echo -n "0000000000$cur" | tail -c ${#total}).jpg" while [ -e "$dst_jpg" ] && [ $addend -lt 1000 ]