From: Scott Worley Date: Tue, 23 Dec 2014 06:12:37 +0000 (-0800) Subject: Support '?' in destination filenames X-Git-Url: http://git.scottworley.com/picsort/commitdiff_plain/ade6dae4cecb45d524771c9ba89863a16e236f65?ds=sidebyside Support '?' in destination filenames --- diff --git a/pic-mv b/pic-mv index 23da8c3..0309ec0 100755 --- a/pic-mv +++ b/pic-mv @@ -24,8 +24,10 @@ fi file="$1" name="$2" +re_escaped_name=$(sed 's/[?+*.]/\\&/g' <<< "$name") + # Find next number -max=$(ls "$destdir" | sed -rn "s/^$name ([0-9]+).jpeg$/\1/p" | sort -n | tail -n1) +max=$(ls "$destdir" | sed -rn "s/^$re_escaped_name ([0-9]+).jpeg$/\1/p" | sort -n | tail -n1) if [[ "$max" ]];then number=$((max + 1)) else