continue - Unix, Linux Command


Advertisements


NAME

continue - To resume the next iteration of an enclosing for, while, until, or select loop.

SYNOPSIS

continue [n]

OPTIONS

TagDescription
[n]If n is supplied, the nth enclosing loop is exited. n must be greater than or equal to 1. The return status is zero unless n is not greater than or equal to 1.

EXAMPLES

Create a Utility Class to use continue.

#continuesample
for myloop in 1 2 3 4 5 
do 
  echo -n "$myloop"
  if [ "$myloop" -eq 3 ] 
   then 
   continue # Skip rest of this particular loop iteration.
  fi
done

Run the utility

$ chmod a+x continuesample
$ ./continuesample
1245


Advertisements