ges-cut-clip.sh: remove leading zeros before performing the multiplications
authorAntonio Ospite <ao2@ao2.it>
Tue, 7 Jun 2016 08:49:28 +0000 (10:49 +0200)
committerAntonio Ospite <ao2@ao2.it>
Tue, 7 Jun 2016 08:49:28 +0000 (10:49 +0200)
shell/ges-cut-clip.sh

index d1a9aec..67494bd 100755 (executable)
@@ -12,8 +12,9 @@ INPUT_FILE="$1"
 read INPOINT_HH INPOINT_MM INPOINT_SS <<< ${2//:/ }
 read DURATION_HH DURATION_MM DURATION_SS <<< ${3//:/ }
 
 read INPOINT_HH INPOINT_MM INPOINT_SS <<< ${2//:/ }
 read DURATION_HH DURATION_MM DURATION_SS <<< ${3//:/ }
 
-INPOINT=$(($INPOINT_HH * 60 * 60 + $INPOINT_MM * 60 + $INPOINT_SS))
-DURATION=$(($DURATION_HH * 60 * 60 + $DURATION_MM * 60 + $DURATION_SS))
+# Remove leading zeros before performing the multiplications
+INPOINT=$((${INPOINT_HH#0} * 60 * 60 + ${INPOINT_MM#0} * 60 + ${INPOINT_SS#0}))
+DURATION=$((${DURATION_HH#0} * 60 * 60 + ${DURATION_MM#0} * 60 + ${DURATION_SS#0}))
 
 [ -e "$4" ] && { echo "Output file already exists, bliling out!" 1>&2; exit 1; }
 OUTPUT_FILE="$4"
 
 [ -e "$4" ] && { echo "Output file already exists, bliling out!" 1>&2; exit 1; }
 OUTPUT_FILE="$4"