LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-23-2012, 11:58 AM   #1
ofer4
Member
 
Registered: Apr 2012
Posts: 100

Rep: Reputation: Disabled
bash something similar to break


hi

in C language, the "break" command is exiting from the "for" loop (not exiting from the whole program, only from the current for loop

is there something similar to break in bash?

i searched and didnt find something intresting

thanks in advance
 
Old 07-23-2012, 12:00 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Code:
$ help break
break: break [n]
     Exit from within a FOR, WHILE or UNTIL loop.  If N is specified,
    break N levels.
 
Old 07-23-2012, 12:34 PM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
man bash, and look for break:
Quote:
break [n]
Exit from within a for, while, until, or select loop. 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 non-zero when n is ≤ 0; Otherwise, break returns 0 value.
where did you search?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash script to replace line break with condition spart1985 Linux - Newbie 8 02-23-2012 09:43 AM
line break on bash script ZAMO Linux - General 5 04-24-2010 12:27 PM
a little bash help with the 'for' command (or similar) checkmate3001 Linux - General 5 02-18-2009 12:52 PM
break it or similar name (rhce) cylent Linux - Certification 4 01-19-2007 11:29 PM
How to grep similar lines in bash? bruno buys Linux - Software 2 12-02-2005 11:56 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration