]> code.delx.au - transcoding/commitdiff
rip-dvd: fixed last number
authorJames Bunton <jamesbunton@delx.net.au>
Mon, 7 Sep 2015 12:07:39 +0000 (22:07 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Mon, 7 Sep 2015 12:07:39 +0000 (22:07 +1000)
rip-dvd

diff --git a/rip-dvd b/rip-dvd
index 690480ac27a95178036bc5a32a3b4566d8690175..118b1f273d36129011d962ddd779c70aafd0f725 100755 (executable)
--- 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))"