From: James Bunton Date: Mon, 7 Sep 2015 12:07:39 +0000 (+1000) Subject: rip-dvd: fixed last number X-Git-Url: https://code.delx.au/transcoding/commitdiff_plain/dc9c3f574b4c9c0969244dabfbea817e34a1cb54 rip-dvd: fixed last number --- diff --git a/rip-dvd b/rip-dvd index 690480a..118b1f2 100755 --- a/rip-dvd +++ b/rip-dvd @@ -11,10 +11,10 @@ fi # Calculate the name for ripping base="$1" last="$(find . -maxdepth 1 -type d -name "${base}*" | sort -n | tail -n 1)" -if [ -z "$last" ]; then - num="1" -elif [ -n "$2" ]; then +if [ -n "$2" ]; then num="$2" +elif [ -z "$last" ]; then + num="1" else num="${last##./${base}}" num="$(($num + 1))"