break in Mac OS X
By: Strauss K Printer Friendly Format
Exit
from a for
, while,
until
or select
loop.
Syntax break [n]
If n is specified, break n levels.
n must be >= 1. If n is greater than the number of enclosing loops, all enclosing loops are exited.
The return value is 0 unless the shell is not executing a loop when break is executed.
Example
for i in 1 2 3 4 5 do echo -n "Hello World${i} " if [ "$i" -eq 3 ] then break # This line will break out of the loop fi done
break is a builtin command.
Most Viewed Articles (in macos ) |
Latest Articles (in macos) |
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview