Skip to content

Instantly share code, notes, and snippets.

@Sailias
Created July 25, 2017 17:41
Show Gist options
  • Save Sailias/ba98c603def206ff1a04b44abdf9b90e to your computer and use it in GitHub Desktop.
Save Sailias/ba98c603def206ff1a04b44abdf9b90e to your computer and use it in GitHub Desktop.
#!/bin/bash
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
CONTINUE_PROCESSING=true
while $CONTINUE_PROCESSING; do
# Read the next line to process
line=$(head -n 1 files/queue.txt)
if [ ${#line} -gt 0 ]; then
# Remove the line from the queue
sed -i.bak '1d' files/queue.txt
printf "${YELLOW} processing $line ${NC}\n"
# Your download here
# Flag the line as complete
echo $line >> files/complete.txt
else
CONTINUE_PROCESSING=false
printf "${RED} processing complete ${NC}\n"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment