Fixed channeldown.sh to work with double digit dirs.

This commit is contained in:
Justin Emter
2018-01-17 09:40:59 -08:00
parent fa1d604d0d
commit 3561f6811e

View File

@@ -75,16 +75,32 @@ if [ "${#CHANNEL_DIR_ARR[@]}" -gt 1 ]; then
NEXT_CHANNEL_NUM=$i
if [ "${i}" -gt 9 ]; then
if [[ ${i} == *"$PREV_CHANNEL"* ]]; then
echo "+++++ Found previous channel, incrementing by 1."
echo "+++++ Found previous channel, decreasing by 1."
PREV_CHANNEL_FOUND=true
PREV_CHANNEL_DIR=${CHANNEL_DIR_ARR[i-1]}
PREV_CHANNEL_DIR="${CHANNEL_DIR_ARR[i-1]}"
continue
fi
else
if [[ "0"${i} == *"$PREV_CHANNEL"* ]]; then
echo "+++++ Found previous channel, decreasing by 1."
PREV_CHANNEL_FOUND=true
PREV_CHANNEL_DIR="${CHANNEL_DIR_ARR[i-1]}"
continue
fi
fi
if [ "$PREV_CHANNEL_FOUND" = true ] ; then
NEXT_CHANNEL=${CHANNEL_DIR_ARR[i-1]}
echo "PREV_CHANNEL_FOUND"
echo "$PREV_CHANNEL_FOUND"
NEXT_CHANNEL="${CHANNEL_DIR_ARR[i-1]}"
break