continue
verb
say it: “kun-TIN-yoo” /kənˈtɪnju/
A command that skips the rest of a loop's commands for this item and moves on to the next one.
What does continue do in bash?
continue skips the rest of this pass of a loop and goes on with the next item, the way a cashier sets aside a coupon that won't scan and serves the next one. A common use is skipping the lines of a list that are only notes.
while read -r minutes title; do
[[ $minutes == "#" ]] && continue # a note, not a song
echo "$title"
done < playlist.txt
In a sentence
- “continue lets the loop pass over the empty files and carry on.”
- “The line starting with # was skipped, thanks to continue.”
Level: Apprentice · More Unix terms at this level
Updated