Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

break(1t) [opensolaris man page]

break(1T)						       Tcl Built-In Commands							 break(1T)

__________________________________________________________________________________________________________________________________________________

NAME
break - Abort looping command SYNOPSIS
break _________________________________________________________________ DESCRIPTION
This command is typically invoked inside the body of a looping command such as for or foreach or while. It returns a TCL_BREAK code, which causes a break exception to occur. The exception causes the current script to be aborted out to the innermost containing loop command, which then aborts its execution and returns normally. Break exceptions are also handled in a few other situations, such as the catch com- mand, Tk event bindings, and the outermost scripts of procedure bodies. EXAMPLE
Print a line for each of the integers from 0 to 5: for {set x 0} {$x<10} {incr x} { if {$x > 5} { break } puts "x is $x" } SEE ALSO
catch(1T), continue(1T), for(1T), foreach(1T), return(1T), while(1T) KEYWORDS
abort, break, loop ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTcl | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tcl is available on http://opensolaris.org. Tcl break(1T)

Check Out this Related Man Page

for(n)							       Tcl Built-In Commands							    for(n)

__________________________________________________________________________________________________________________________________________________

NAME
for - ``For'' loop SYNOPSIS
for start test next body _________________________________________________________________ DESCRIPTION
For is a looping command, similar in structure to the C for statement. The start, next, and body arguments must be Tcl command strings, and test is an expression string. The for command first invokes the Tcl interpreter to execute start. Then it repeatedly evaluates test as an expression; if the result is non-zero it invokes the Tcl interpreter on body, then invokes the Tcl interpreter on next, then repeats the loop. The command terminates when test evaluates to 0. If a continue command is invoked within body then any remaining commands in the current execution of body are skipped; processing continues by invoking the Tcl interpreter on next, then evaluating test, and so on. If a break command is invoked within body or next, then the for command will return immediately. The operation of break and continue are similar to the corresponding statements in C. For returns an empty string. Note: test should almost always be enclosed in braces. If not, variable substitutions will be made before the for command starts execut- ing, which means that variable changes made by the loop body will not be considered in the expression. This is likely to result in an infinite loop. If test is enclosed in braces, variable substitutions are delayed until the expression is evaluated (before each loop iter- ation), so changes in the variables will be visible. For an example, try the following script with and without the braces around $x<10: for {set x 0} {$x<10} {incr x} { puts "x is $x" } SEE ALSO
break, continue, foreach, while KEYWORDS
for, iteration, looping Tcl for(n)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to define two variable in foreach command??

Hello, I just want to know how If it's possiple to define 2 variable using foreach command ??? I have directory inside that directory around 1000 file, I want to rename all of this files to something I have it in a list. Example :- ------This is what in my directory---------- d1 d2... (14 Replies)
Discussion started by: geoquest
14 Replies

2. UNIX for Dummies Questions & Answers

attempting to break within function

Attempting to break from a case/esac paragraph while inside of a function. When executing the code below, entering the letter 'a', will prove that the directory exists, but the break command works for the if/fi, but not for the case/esac. So, in my example below, if an A is entered, the function... (8 Replies)
Discussion started by: tumblez
8 Replies

3. Programming

Cannot catch SIGINT while serial break condition occurs

I setup termios structure with IGNBRK is not set and BRKINT is set. To allow the process to receive signals I call: fcntl(fd, F_SETOWN, getpid()); I have made a signal handler to catch all signals. I can catch SIGINT when pressing ctrl+c but when I send break signal over serial then it cannot... (13 Replies)
Discussion started by: gzz
13 Replies

4. Shell Programming and Scripting

Looping

Hi, Now I have written a script which sorts the records in the file and splits them according to some condition. Now, I need to modify the script so that it reads all the files one after the other and does the sorting & splitting. Pls help me in reading all the files in a directory and... (8 Replies)
Discussion started by: Sunitha_edi82
8 Replies

5. Shell Programming and Scripting

break out of 'if'

is it possible? because i still need to keep on reading even though i don't want to read that particular line (7 Replies)
Discussion started by: finalight
7 Replies

6. Shell Programming and Scripting

Break command

have a query on this break. I am using a program where I am using a while loop to execute it. It will get into a file take the first file and then ping it and if the ip is reachable then it will mail. Now what happens is that when i ping the ip it does nopt come out of the loop and it says "reply... (11 Replies)
Discussion started by: venkidhadha
11 Replies

7. Shell Programming and Scripting

Problem in While loop

Hi Guys, This is my code.. I am getting an error in the inside while statement when comparing.. I am not able to figure it out.. Pls help me... while read value fatherid son_id top_id r_type do inside_value=1; echo $inside_value; echo $r_type; while do echo... (6 Replies)
Discussion started by: mac4rfree
6 Replies

8. Shell Programming and Scripting

break: cannot break

hi guys I am working on a menu for linux... some basic stuff. but I have an issue. I got 1 server where something is working and the same thing does not work in the same way in another linux box Basically I am simulating a command line where user insert some commands and to end and go back... (7 Replies)
Discussion started by: karlochacon
7 Replies

9. Shell Programming and Scripting

Script to Reboot and Confirm

On my Solaris box I have to reboot some devices like below. However I think this can be done through a script. I've create a list that contains the devices IP addresses. Here's the logic: Reboot 4 devices and sleep for 5mins(300s.) While the devices are rebooting, I would like to confirm... (9 Replies)
Discussion started by: ravzter
9 Replies

10. Shell Programming and Scripting

Text Processing with a line break

Dear Masters, Need your help to process the below file named "breakline". At some places the rows are broken into two lines and each rows starts with a tab space. >cat breakline _Index 187 18.4K 92 137 100 190 1.0 3.3 _Index-Field 365 26.7K 74 76 75 365 1.0 2.5 _KeyEvent 0 0.0B 0 0 0 0... (8 Replies)
Discussion started by: patric2326
8 Replies

11. Shell Programming and Scripting

trouble looping in script

I am having problem looping this script I want to give the user option to decide if they want to continue after each entry but then also loop it back to beginning so they can more to content of there testcase they just created. I fam new to scripting so loops are little tricky for me. code I... (7 Replies)
Discussion started by: andrew.p.mcderm
7 Replies

12. Shell Programming and Scripting

Print list to row using awk

Hello, can somebody help me on this please. I have a list of numbers and I want to print them in one line seprated by a comma except the last one using awk 34 12 56 76 88 output 34,12,56,76,88 Thanks Sara (15 Replies)
Discussion started by: Sara_84
15 Replies

13. Shell Programming and Scripting

Df -h results in a loop

Hello everyone, I am doing a check of the disk space using df -h, I want to combine the result in break line; but the result after while/done is empty: # df -h Filesystem Size Used Avail Use% Mounted on rootfs 20G 14G 4.6G 75% / /dev/root 20G 14G 4.6G 75% /... (15 Replies)
Discussion started by: Abu Rayane
15 Replies

14. Shell Programming and Scripting

Building a dynamic UNIX menu with input files

Hi! I am looking to build dynamic menu (named: lookup.sh) that reads a pipe delimited file for input. for example, contents of input.txt could be: user1|srv1 user3|srv1 user4|srv1 user2|srv2 I want the menu look like: 1) get password for user1 on srv1 2) get password for user3 on... (7 Replies)
Discussion started by: cpolikowsky
7 Replies

15. UNIX for Beginners Questions & Answers

How to make paste -d second file print down while looping?

]I would like to make the second file label 'b' print down the first file label 'a', like shifting down the file creating new lines I want it to print all the way down until the first line of the second file hit the last line of the first file. Would I have to put this into a file itself or could I... (24 Replies)
Discussion started by: bigvito19
24 Replies