🌐
TutorialsPoint
tutorialspoint.com › unix_commands › continue.htm
continue Command in Linux
continue is a Linux command that you can use within loops (like for, while or until) to skip the current iteration. When you use the continue command in a program, it immediately terminates the current loop iteration and forwards towards the next
🌐
Linuxize
linuxize.com › home › bash › bash break and continue statements
Bash break and continue Statements | Linuxize
May 2, 2026 - The [n] argument is optional and can be greater than or equal to 1. When [n] is given, the nth enclosing loop is resumed. continue 1 is equivalent to continue. In the example below, once the current iterated item equals 2, the continue statement will cause execution to return to the beginning of the loop and continue with the next iteration:
Discussions

csh - continue in unix - Stack Overflow
I'm writin scripts and I'm very curious, does c-shell have somethin like continue in C. More on stackoverflow.com
🌐 stackoverflow.com
shell - In a Bash Script how does the continue command work with embedded loops? - Unix & Linux Stack Exchange
I am writing a bash script in a busybox session. The script has to initiate an external executable numerous times in sequence in daemonised form then monitor the output. while read LINE; do More on unix.stackexchange.com
🌐 unix.stackexchange.com
bash - Return "continue" from function called from loop - Unix & Linux Stack Exchange
I'm currently refactoring a script which has slowly grown beyond control. I'm trying to spin off repetition into functions. However, I have a repeated test being called from a loop, and want it to ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
shell script - when to use line-continuation character and when not? - Unix & Linux Stack Exchange
I have been reading "The Linux command line book" and I have encountered this line continuation character and I am confused why do we use it with this find command: find playground \ \( \ ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
March 5, 2020
People also ask

Can I use `break` and `continue` in the same loop?
Yes. You can use both statements in the same loop. For example, `continue` to skip certain iterations and `break` to exit when a condition is met.
🌐
linuxize.com
linuxize.com › home › bash › bash break and continue statements
Bash break and continue Statements | Linuxize
Can I use `break` and `continue` outside a loop?
No. Using `break` or `continue` outside a loop will produce an error saying the statement is only meaningful in a `for`, `while`, or `until` loop. The script will continue running, but the statement has no effect.
🌐
linuxize.com
linuxize.com › home › bash › bash break and continue statements
Bash break and continue Statements | Linuxize
Do `break` and `continue` work in `select` loops?
Yes. Both statements work in `select` loops the same way they work in `for`, `while`, and `until` loops.
🌐
linuxize.com
linuxize.com › home › bash › bash break and continue statements
Bash break and continue Statements | Linuxize
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › continue-command-in-linux-with-examples
Continue Command in Linux with examples - GeeksforGeeks
June 9, 2023 - Linux-Unix · Interview Questions ... Java · Last Updated : 9 Jun, 2023 · continue is a command which is used to skip the current iteration in for, while, and until loop....
🌐
CyberCiti
bash.cyberciti.biz › guide › Continue_statement
Continue statement - Linux Bash Shell Scripting Tutorial Wiki
The continue statement is used to resume the next iteration of the enclosing FOR, WHILE or UNTIL loop.
Find elsewhere
🌐
Unix.com
unix.com › man_page › linux › 1 › continue
linux continue man page on unix.com
DESCRIPTION The continue utility shall return to the top of the smallest enclosing for, while, or until loop, or to the top of the nth enclosing loop, if n is specified. This involves repeating the condition list of a while or until loop or ...
🌐
Linux Command Library
linuxcommandlibrary.com › man › continue
continue man | Linux Command Library
'n' must be an integer greater than or equal to 1. The continue command is a shell built-in that alters the flow of control within looping constructs such as for, while, until, and select loops.
🌐
The Linux Documentation Project
tldp.org › LDP › Bash-Beginners-Guide › html › sect_09_05.html
9.5. Break and continue
In nested loops, break allows for specification of which loop to exit. See the Bash info pages for more. The continue statement resumes iteration of an enclosing for, while, until or select loop.
🌐
LinuxForDevices
linuxfordevices.com › home › shell script › shell scripting 101: break and continue statement in linux
Shell Scripting 101: Break and Continue Statement in Linux - LinuxForDevices
August 6, 2022 - This will let the loop finish the entire number of iterations that it is supposed to finish. All it will do is, for a certain condition, skip the entire loop after the continue statement to restart the loop. Let’s see it in action to understand it better.
🌐
TutorialsPoint
tutorialspoint.com › unix › unix-loop-control.htm
Unix / Linux - Shell Loop Control
In the inner loop, you have a break ... is similar to the break command, except that it causes the current iteration of the loop to exit, rather than the entire loop....
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › bash continue: how to resume a loop
Bash continue: How to Resume a Loop
August 2, 2023 - Line 5 starts an inner for loop, incrementing the variable j from 1 to 5 for each i increment. Line 7 checks if the variables i and j are equal ($i -eq $j). If they are, the continue 2 statement resumes the outer loop at the next iteration.
🌐
GeeksforGeeks
geeksforgeeks.org › break-and-continue-keywords-in-linux-with-examples
Break and Continue Keywords in Linux with Examples | GeeksforGeeks
December 24, 2020 - So, the only value of j is printed when it was 1. Continue is a command which is used to skip the remaining command inside the loop for the current iteration in for, while, and until loop.
🌐
TecMint
tecmint.com › home › bash shell › how to use break and continue statements in shell scripts
How to Use Break and Continue Statements in Shell Scripts
March 24, 2021 - In this article, we will take a look at how to use a break and continue in bash scripts. In bash, we have three main loop constructs (for, while, until). Break and continue statements are bash builtin and used to alter the flow of your loops.
🌐
Network World
networkworld.com › home › blogs › unix as a second language
Using ‘break’ and ‘continue’ to exit loops in bash | Network World
September 23, 2022 - They allow you to exit a loop early or skip the remaining commands in the loop and return to the beginning. Both the break and the continue commands are meant to be used only in for, while and until loops.
🌐
thelinuxvault
thelinuxvault.net › blog › continue-command-in-linux-with-examples
Mastering the `continue` Command in Linux Scripting
Among the various control structures, the `continue` command plays a crucial role in loop management. This powerful command allows you to skip the current iteration of a loop and proceed directly to the next one, saving processing time and making ...
🌐
Namehero
namehero.com › blog › what-is-the-bash-continue-statement-and-how-to-use-it
What Is The Bash Continue Statement And How To Use It?
November 6, 2024 - The same goes for bash loops which allow for specific code to loop through to perform specified tasks. The bash continue statement is used within loops to skip the current iteration of the loop before the loop starts over again.
Top answer
1 of 2
5

The simple answer is that because the former needs it, and the latter doesn't.

That find command is a single simple shell command, which just takes a number of distinct arguments, and has a structure of its own. Those arguments are just not meaningful to the shell, so it doesn't know there's e.g. a logical connection between the ( and the ). The whole command could be written on a single line, it would just be harder to read.

Without the line continuations, find would run on playground with the default printing action, and then the shell would try to run the command ( without arguments (or, the command -type in a subshell, if you were to remove the escape from the (, too):

find playground
    \(
        -type f 
        ...

On the other hand, the if compound statement is part of the shell syntax, and the shell knows what parts there are to expect. After the then there must be a command, and eventually an else or fi. The whole structure could also be written on a single line, but then we'd need to add semicolons before the else and the fi. (In the same way echo foo; echo bar requires to semicolon or a newline to be taken as two commands.)

2 of 2
4

This is a particularly complex example because some of the \ there are what you're calling "line-continuation" but others are to protect characters so the shell doesn't interpret them and instead passes them to find. Specifically, the \(, \) and \; are there so that the shell doesn't interpret the escaped characters and passes them as-is to find. The rest, the \ that aren't immediately before a non-space character are line continuation signals.

In general, if you want to break a command, you need the \ unless you break on one of the "list terminator" characters. So, if you cut after one of these, you don't need the \:

; & && || | |& ;; 

For example, echo foo && echo bar can be written as:

echo foo &&
echo bar

No need for \. Alternatively, the same thing can also be written as:

echo \
foo \
&&
echo \
bar

Note how I have used the \ when cutting at places that are neither the end of a command nor a list terminator.

If you cut a command anywhere else, you need the \. You don't need the \ in the if ... then ... else ... example you show because there, you aren't cutting a command. Each command is on its own line, and that's fine. You only need the \ if you want to break a single command onto multiple lines.

As @paul_pedant correctly pointed out in the comments, you can make the command much clearer if you use single quotes to escape things for find:

find playground \
    '(' \
        -type f \
        -not -perm 0600 \
        -exec chmod 0600 {} ';' \
    ')' \
    -or \
    '('
        other options...
    ')'