From 2e191cd6f5afd90613794afd687488fa9acd2c1f Mon Sep 17 00:00:00 2001 From: Justin Emter Date: Fri, 22 Dec 2017 14:06:42 -0800 Subject: [PATCH] Added more logic for channelup/channeldown scripts to they cycle sequencially and with double digits (_01, _02, etc.) --- multi-channel-bash-scripts/channeldown.sh | 2 +- multi-channel-bash-scripts/channelup.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/multi-channel-bash-scripts/channeldown.sh b/multi-channel-bash-scripts/channeldown.sh index 995f474..f7cec21 100644 --- a/multi-channel-bash-scripts/channeldown.sh +++ b/multi-channel-bash-scripts/channeldown.sh @@ -38,7 +38,7 @@ CHANNEL_DIR_INCREMENT_SYMBOL="_" FIRST_RUN=false # Scan the dir to see how many channels there are, store them in an arr. -CHANNEL_DIR_ARR=( $(find . -maxdepth 1 -type d -name '*'"$CHANNEL_DIR_INCREMENT_SYMBOL"'[[:digit:]]*' -printf "%P\n") ) +CHANNEL_DIR_ARR=( $(find . -maxdepth 1 -type d -name '*'"$CHANNEL_DIR_INCREMENT_SYMBOL"'[[:digit:]]*' -printf "%P\n" | sort -t_ -n) ) # If the previous channel txt file doesn't exist already create it (first run?) if [ ! -e "$OUTPUT_PREV_CHANNEL_PATH/$OUTPUT_PREV_CHANNEL_FILE" ]; then diff --git a/multi-channel-bash-scripts/channelup.sh b/multi-channel-bash-scripts/channelup.sh index 168ab1a..3a6fd27 100644 --- a/multi-channel-bash-scripts/channelup.sh +++ b/multi-channel-bash-scripts/channelup.sh @@ -49,7 +49,7 @@ fi # If the file exists b # Scan the dir to see how many channels there are, store them in an arr. -CHANNEL_DIR_ARR=( $(find . -maxdepth 1 -type d -name '*'"$CHANNEL_DIR_INCREMENT_SYMBOL"'[[:digit:]]*' -printf "%P\n") ) +CHANNEL_DIR_ARR=( $(find . -maxdepth 1 -type d -name '*'"$CHANNEL_DIR_INCREMENT_SYMBOL"'[[:digit:]]*' -printf "%P\n" | sort -t_ -n) ) # If this script see's there are multiple channels, # then read file, get prevchannel, increment, and trigger next channel: