DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Programming with the SCO OpenServer system shell

Unconditional control statements: break and continue

The break command unconditionally stops the execution of any loop in which it is encountered, and goes to the next command after the done, fi, or esac statement. If no commands follow that statement, the program ends.

In the example for set.term, you could have used the break command instead of echo to leave the program, as the next example shows:

   $ cat set.term
   echo If you have a TTY 4420 type in 4420
   echo If you have a TTY 5410 type in 5410
   echo If you have a TTY 5420 type in 5420
   read term
   case $term
   	in
   		4420)
   		TERM=T4
   	;;
   	5410)
   		TERM=T5
   	;;
   	5420)
   		TERM=T7
   	;;
   	*)
   		break
   	;;
   esac
   export TERM
   echo end of program
   $

The continue command causes the program to go immediately to the next iteration of a while or for loop without executing the remaining commands in the loop.


Next topic: Functions
Previous topic: The case . . . esac conditional construct

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005