Friday, December 16, 2022

Linux - Break

The following is a Linux dictionary word of the day:

break shell script variable which accounts for exiting from a loop

n option number of how many times loop runs, the default is 1.

Example:

                #!/bin/bash

for ((i=1;i<=5;i++)); do

           echo $i

           if [ $i -eq 3 ]; then

           break

     fi

done

No comments:

Post a Comment