Sponsored Content
Top Forums Shell Programming and Scripting Multiple conditionals in a while loop Post 302141418 by Ygor on Friday 19th of October 2007 12:59:22 AM
Old 10-19-2007
Using "break" violates good programming standards because it breaks the "single-entry single-exit" rule for control structures.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ideas for perl script - strings,conditionals..etc

I have a matrix , how do I compare all the elements of a column , lets say I want to check if the columns contain the alphabets "S","H","A","R","A","T". and not "X"s. Lets say matrix looks something like this .. SSSXSH HHXXHA AAXXAT RRRXRS AAXTAR TTTTTA I can hard code it where... (4 Replies)
Discussion started by: sharatz83
4 Replies

2. Shell Programming and Scripting

Multiple Conditionals

Yet another question. I want to make something like this: if ||&& then ... fi but that apparently is not right. I want either the first condition to be true OR the second AND third conditions to be true for the "then" to be processed. How can I do this? (1 Reply)
Discussion started by: jeriryan87
1 Replies

3. Shell Programming and Scripting

Using arrays with conditionals

Pardon the pseudo code below, but I'm wondering how I would do something along the lines of this... #!/bin/sh excludeList="A B" theItem="C" if then echo $theItem fi I know I could loop through the array and check against each value, but was wondering if there was an alternate way... (1 Reply)
Discussion started by: myndcraft
1 Replies

4. Shell Programming and Scripting

Log successful unix conditionals

Dears, Can anyone advise how to log successful conditionals (unix commands) from any ksh script? For example, the code is as follows: if <command> then Block1 of statements else Block2 of statements fi What needed exactly is to log "Block1 of statements" if its conditon is met.... (4 Replies)
Discussion started by: kadi
4 Replies

5. Shell Programming and Scripting

mysql help : query with 2 conditionals

Hi there, I have a table that stores multiple records for many different servers, each of which is timestamped ... I wanted to write a query that would enable me to only output the "latest" record (based on timestamp) for each "unique" server. So for example my main table looks like this ... (3 Replies)
Discussion started by: hcclnoodles
3 Replies

6. Shell Programming and Scripting

Reset while loop to loop same file multiple times

Hi, I want to read file multiple times. Right now i am using while loop but that is not working. ex. While read line do while read line2 do echo stmt1 #processing some data based on data., done < file2.txt done < file1.txt # This will have 10... (4 Replies)
Discussion started by: tmalik79
4 Replies

7. Shell Programming and Scripting

Script no conditionals

Hello, pro scripters, noob here, I am complete noob in this and I have to write a program which: Calculates the modulus of two numbers which the user enters with keyboard. Number interval 1-9. These two numbers that were entered and modulus which was calculated are stored in a separate file.... (1 Reply)
Discussion started by: IrmantasID
1 Replies

8. Programming

Gnu make: default values and conditionals

I need some help. I use variables and conditionals to build with or without specic libraries. I set USEAL ?= 1 # get value from cmd, defaults to 1 (see comment) the conditional is: ifeq ($(USEAL),1) LIBS = <any libs> else LIBS = endif Its amazing that this works when invoked... (4 Replies)
Discussion started by: dodona
4 Replies
break(1)							   User Commands							  break(1)

NAME
break, continue - shell built-in functions to escape from or advance within a controlling while, for, foreach, or until loop SYNOPSIS
sh break [n] continue [n] csh break continue ksh *break [n] *continue [n] DESCRIPTION
sh The break utility exits from the enclosing for or while loop, if any. If n is specified, break n levels. The continue utility resumes the next iteration of the enclosing for or while loop. If n is specified, resume at the n-th enclosing loop. csh The break utility resumes execution after the end of the nearest enclosing foreach or while loop. The remaining commands on the current line are executed. This allows multilevel breaks to be written as a list of break commands, all on one line. The continue utility continues execution of the next iteration of the nearest enclosing while or foreach loop. ksh The break utility exits from the enclosed for, while, until, or select loop, if any. If n is specified, then break n levels. If n is greater than the number of enclosing loops, the outermost enclosing loop shall be exited. The continue utility resumes the next iteration of the enclosed for, while, until, or select loop. If n is specified then resume at the n- th enclosed loop. If n is greater than the number of enclosing loops, the outermost enclosing loop shall be used. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words that follow a command preceded by ** that are in the format of a variable assignment are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign, and also that word splitting and file name genera- tion are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), exit(1), ksh(1), sh( 1), attributes(5) SunOS 5.10 17 Jul 2002 break(1)
All times are GMT -4. The time now is 08:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy