From 59df44445e51b871aa0bda81880533433f45cb35 Mon Sep 17 00:00:00 2001 From: fpunktk Date: Sat, 30 Dec 2017 12:26:31 +0100 Subject: [PATCH] use dirname instead of string handling --- anondcim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 ] -- 2.30.2