mirror of
https://github.com/FakeTV/pseudo-channel.git
synced 2025-12-20 18:23:44 +00:00
Fixed channeldown.sh to work with double digit dirs.
This commit is contained in:
@@ -72,19 +72,35 @@ if [ "${#CHANNEL_DIR_ARR[@]}" -gt 1 ]; then
|
||||
|
||||
# Now that the prevchannel is stored in a var, loop through channels and find prev channel & increment
|
||||
for ((i = ${#CHANNEL_DIR_ARR[@]};i >= 1;i--)); do
|
||||
|
||||
|
||||
NEXT_CHANNEL_NUM=$i
|
||||
|
||||
if [[ ${i} == *"$PREV_CHANNEL"* ]]; then
|
||||
echo "+++++ Found previous channel, incrementing by 1."
|
||||
PREV_CHANNEL_FOUND=true
|
||||
PREV_CHANNEL_DIR=${CHANNEL_DIR_ARR[i-1]}
|
||||
continue
|
||||
if [ "${i}" -gt 9 ]; then
|
||||
|
||||
if [[ ${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
|
||||
|
||||
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
|
||||
|
||||
echo "PREV_CHANNEL_FOUND"
|
||||
echo "$PREV_CHANNEL_FOUND"
|
||||
|
||||
NEXT_CHANNEL=${CHANNEL_DIR_ARR[i-1]}
|
||||
NEXT_CHANNEL="${CHANNEL_DIR_ARR[i-1]}"
|
||||
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user