Loop-Related Commands
The shell provides several loop-related commands to be used in special logic circumstances. For instance, suppose you were executing a while loop and wanted to skip the execution of the rest of the current pass of the loop but continue processing the loop. The continue command provides this capability.
You also might want to exit from a loop prematurely. The break command provides this capability. If you want to exit from the script, you can use the exit command. The exit command can be followed by an exit status, which will be accessible outside the script through $?.
The shift command is a specialized command used to shift the positional parameters (sometimes called command-line arguments) so that one fewer exists than ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access