Sponsored Content
Full Discussion: Multiple while statements?
Top Forums Shell Programming and Scripting Multiple while statements? Post 302576345 by nickzourdos on Thursday 24th of November 2011 10:41:45 AM
Old 11-24-2011
Fixed it!

My syntax for the while loop that checked STATE was bad. In bash, you have to use -a instead of &&:

Code:
while [ "$STATE" != "MI" -a "$STATE" != "OH" -a "$STATE" != "IL" -a "$STATE" != "IN" ];do
   echo "Sorry, that's not an accepted state."
   echo "Enter State: "; read STATE
done

And for some reason, my bash won't recognize the let command... so I have to use expr instead for a counter:

Code:
COUNT=0
while [ "$COUNT" -le "5" ]; do
  echo "Count is less than 5."
  COUNT=`expr $COUNT + 1`
done

The wonders of a good night's sleep.....

Last edited by nickzourdos; 11-24-2011 at 01:03 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

multiple conditions in if statements

Hi all, I'm confused about the proper syntax for multi-conditional if then statements. I'm trying to set limitations on info input on the command line.. i.e. if ] ;then $x=$vr1 else print "You have entered an invalid option." Can someone please clue me in on what is wrong with my syntax;... (3 Replies)
Discussion started by: tim mauger
3 Replies

2. Shell Programming and Scripting

multiple 'if' statements out of array

I want to do multiple comparisons on a series of numbers from an array: I send the numbers in file1 through want to print out some info from file2 based on some conditions. The syntax just isn't correct??? awk ' NR==FNR{ a=$0 next ... (2 Replies)
Discussion started by: dcfargo
2 Replies

3. Shell Programming and Scripting

How do I execute multiple statements within If then else

Please help me. I have been doing this for several hours. Here is the code if then echo a b c d >> file.txt echo 1111 >> file.txt fi The reason I want the two echo is because I want these statements printed on multiple lines. I keep getting error . First it tells me... (2 Replies)
Discussion started by: asemota
2 Replies

4. Shell Programming and Scripting

Running multiple if statements

Hi, Hav automated a process, and it is working fine. for first process alone status = ` ps -ef |grep a ` if then echo " Success" > temp/logfile else echo " Failure" > temp/logfile fi Now I hav to write script to automated some 2 process and then send mail using cron.. ... (5 Replies)
Discussion started by: NehaKrish
5 Replies

5. Shell Programming and Scripting

execute multiple statements in if-else

how can we execute multiple statements in else condition i have if then statement else statements fi in else condition i have multiple statements but it executing only one statement is there any way to execute multiple statements (4 Replies)
Discussion started by: nani1984
4 Replies

6. Shell Programming and Scripting

multiple echo statements in if condition

Hi , I have a peculiar problem. i have an if block like this if ; then echo " todays date is " ${date} >> log_file echo " file count is " $ count >> log_file mv filename1 filename 2 else echo "no files available ">> log_file fi the echo statement "no files available " is not... (2 Replies)
Discussion started by: wizardofoz
2 Replies

7. Shell Programming and Scripting

Multiple if Statements

Hi All, I need to check for 3 conditions and if all the 3 are not satified need to say that services are not running.... is the below code correct. #********** Check to see if Service 1 is still running************** if then echo "$datetimestamp: Service1 is not running" >>... (4 Replies)
Discussion started by: ch33ry
4 Replies

8. Shell Programming and Scripting

Multiple If statements in bash problem

Hi everyone, May you help me with the correct syntax of the follow bash statements please X=10 if ]; then echo "The value is between 1 and 5" for ((i=1;i<=${X})); do echo $i done else if ]; then echo "The value is between 6 and 10" for ((i=1;i<=${X})); do ... (5 Replies)
Discussion started by: Ophiuchus
5 Replies

9. UNIX for Dummies Questions & Answers

Multiple if statements

exmaple: file1 and file2 has 1 bit if then exit else send out email fi if then exit else send out email fi it exits the 1st if. did not continue with my 2nd if. thanks in advanced. Please use CODE tags are suggested on every page when you post an item in... (7 Replies)
Discussion started by: lawsongeek
7 Replies

10. Shell Programming and Scripting

Using multiple 'for' statements

Hello, I am new to scripting and I am trying to write a simple script that creates users and adds their passwords from two files; one a user list file and another a password list file. For example, I have two files already. $ cat file1 andy stephane aby paul $ cat file2 123 234... (4 Replies)
Discussion started by: FemoTheDon
4 Replies
LaTeXML::State(3pm)					User Contributed Perl Documentation				       LaTeXML::State(3pm)

NAME
"LaTeXML::State" - stores the current state of processing. DESCRIPTION
A "LaTeXML::State" object stores the current state of processing. It recording catcodes, variables values, definitions and so forth, as well as mimicing TeX's scoping rules. Access to State and Processing "$STATE->getStomach;" Returns the current Stomach used for digestion. "$STATE->getModel;" Returns the current Model representing the document model. Scoping The assignment methods, described below, generally take a $scope argument, which determines how the assignment is made. The allowed values and thier implications are: global : global assignment. local : local assignment, within the current grouping. undef : global if global preceded, else local (default) <name> : stores the assignment in a `scope' which can be loaded later. If no scoping is specified, then the assignment will be global if a preceding "global" has set the global flag, otherwise the value will be assigned within the current grouping. "$STATE->pushFrame;" Starts a new level of grouping. Note that this is lower level than "group"; See LaTeXML::Stomach. "$STATE->popFrame;" Ends the current level of grouping. Note that this is lower level than "egroup"; See LaTeXML::Stomach. "$STATE->setPrefix($prefix);" Sets a prefix (eg. "global" for "global", etc) for the next operation, if applicable. "$STATE->clearPrefixes;" Clears any prefixes. Values "$value = $STATE->lookupValue($name);" Lookup the current value associated with the the string $name. "$STATE->assignValue($name,$value,$scope);" Assign $value to be associated with the the string $name, according to the given scoping rule. Values are also used to specify most configuration parameters (which can therefor also be scoped). The recognized configuration parameters are: VERBOSITY : the level of verbosity for debugging output, with 0 being default. STRICT : whether errors (eg. undefined macros) are fatal. INCLUDE_COMMENTS : whether to preserve comments in the source, and to add occasional line number comments. (Default true). PRESERVE_NEWLINES : whether newlines in the source should be preserved (not 100% TeX-like). By default this is true. SEARCHPATHS : a list of directories to search for sources, implementations, etc. "$STATE->pushValue($name,$value);" This is like "->assign", but pushes a value onto the end of the stored value, which should be a LIST reference. Scoping is not handled here (yet?), it simply pushes the value onto the last binding of $name. "$boole = $STATE->isValuebound($type,$name,$frame);" Returns whether the value $name is bound. If $frame is given, check whether it is bound in the $frame-th frame, with 0 being the top frame. Category Codes "$value = $STATE->lookupCatcode($char);" Lookup the current catcode associated with the the character $char. "$STATE->assignCatcode($char,$catcode,$scope);" Set $char to have the given $catcode, with the assignment made according to the given scoping rule. This method is also used to specify whether a given character is active in math mode, by using "math:$char" for the character, and using a value of 1 to specify that it is active. Definitions "$defn = $STATE->lookupMeaning($token);" Get the "meaning" currently associated with $token, either the definition (if it is a control sequence or active character) or the token itself if it shouldn't be executable. (See LaTeXML::Definition) "$STATE->assignMeaning($token,$defn,$scope);" Set the definition associated with $token to $defn. If $globally is true, it makes this the global definition rather than bound within the current group. (See LaTeXML::Definition, and LaTeXML::Package) "$STATE->installDefinition($definition, $scope);" Install the definition into the current stack frame under its normal control sequence. Named Scopes Named scopes can be used to set variables or redefine control sequences within a scope other than the standard TeX grouping. For example, the LaTeX implementation will automatically activate any definitions that were defined with a named scope of, say "section:4", during the portion of the document that has the section counter equal to 4. Similarly, a scope named "label:foo" will be activated in portions of the document where "label{foo}" is in effect. "$STATE->activateScope($scope);" Installs any definitions that were associated with the named $scope. Note that these are placed in the current grouping frame and will disappear when that grouping ends. "$STATE->deactivateScope($scope);" Removes any definitions that were associated with the named $scope. Normally not needed, since a scopes definitions are locally bound anyway. "$sp = $STATE->convertUnit($unit);" Converts a TeX unit of the form '10em' (or whatever TeX unit) into scaled points. (Defined here since in principle it could track the size of ems and so forth (but currently doesn't)) AUTHOR
Bruce Miller <bruce.miller@nist.gov> COPYRIGHT
Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US. perl v5.10.1 2009-06-11 LaTeXML::State(3pm)
All times are GMT -4. The time now is 02:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy