How Do You Exit a Loop in Linux?
Contents You Can Use the Break Command to Exit from Any Loop, Like the While and the Until Loops. the Loop Runs Until It Reaches 14 Then the Command Exits the...
Contents
You can use the break command to exit from any loop, like the while and the until loops. The loop runs until it reaches 14 then the command exits the loop.
How do you end a loop in Linux?
If you want to exit the loop instead of exiting the script, use a break command instead of an exit. #!/bin/bash while true do if [ `date +%H` -ge 17 ]; then break # exit loop fi echo keep running ~/bin/process_data done …
Must Read
How do you exit a loop in Unix?
break exits from a for, select, while, or until loop in a shell script. If number is given, break exits from the given number of enclosing loops.