Sponsored Content
Full Discussion: Execute while loop
Top Forums UNIX for Advanced & Expert Users Execute while loop Post 302278423 by shubhranshu on Tuesday 20th of January 2009 07:34:29 AM
Old 01-20-2009
Hi,
Thanks for the suggestion.

I tried droping 1 with the parenthesis , braces and brackets but then it is giving the following error:-

hyper20:~ 15> while true
while: Expression Syntax.
hyper20:~ 16> while false
while: Expression Syntax.
hyper20:~ 17>


My intended execution of steps are:-

while [1]
do
ps -eaf | grep rm
sleep 10
done

But then this is not working when I execute it from the command prompt Smilie

Could you please help me in this ?

Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute commands parallel in a for loop ?

Hi, please can someone point me in the right direction with a shell scripting problem. I want to execute a command in a for loop and the command should be started not one-by-one meaning the for loop is waiting for the exit code , it should be started in parallel. I have a plain text file... (3 Replies)
Discussion started by: networkfre@k
3 Replies

2. Shell Programming and Scripting

loop does not execute in bash script?

I have a very basic bash shell script, which has many "while... done; for .... done" loop clauses, like the following ~~ #!/bin/bash while blablalba; do .... done < /tmp/file for line in `cat blablabla`; do grep $line /tmp/raw ; done > /tmp/1; while blablalba2; do .... done <... (2 Replies)
Discussion started by: fedora
2 Replies

3. UNIX for Dummies Questions & Answers

how to execute a while loop for 20 minutes?

I want to execute a while loop (or any other loop) for 20 minutes. I have extracted the minutes and seconds from the current system date by using the command y = `date +%M%S` How to proceed ?? (6 Replies)
Discussion started by: subhotech
6 Replies

4. Shell Programming and Scripting

Execute Loop in Telnet

hi Everyone , have a nice day #!/bin/sh ( sleep 1 echo "LOGIN:username:password;" sleep 1 while IFS= read -r line do #echo $line GET:VOUCHERDETAIL:VoucherSerialNumber,$line; >> /home/status_log done < /home/status.txt sleep 1 echo "LOGOUT;") | telnet 127.0.0.1 7021 , it... (2 Replies)
Discussion started by: Dastard
2 Replies

5. UNIX for Dummies Questions & Answers

For Loop to execute a command on a series of files

Hello, I have a set of input data that I split into batches using the following command: split -l 4000000 MyInput.in Split_a Once I get the split files, I run a certain command on the split files that spews an output. So far I have been doing it without a for loop. How can I translate the... (2 Replies)
Discussion started by: Gussifinknottle
2 Replies

6. UNIX for Dummies Questions & Answers

unable to execute while loop

Hi everyone. I wanted to print numbers from 1 to 5 in reverse order. For this I used the following code: #!/bin/bash x=5 while do echo $x x=`expr $x - 1` echo "" done echo "" Well but on compiling the above code, it gives the following error. ... (3 Replies)
Discussion started by: grc
3 Replies

7. Shell Programming and Scripting

How to execute a no of SELECT COUNT(*) statements using a loop

HI Unix Gurus, I have a number of SELECT count(*) statements in an input file and I want to execute it using a shell script but one by one using loop in script.... How can I do this..... (7 Replies)
Discussion started by: ustechie
7 Replies

8. Shell Programming and Scripting

Execute command with loop

I have a below command ALTER TABLE `abc` ADD PARTITION ( PARTITION 20130613 VALUES less than (DAY('13'))); Below is requirement It runs in Loop as DAY start with 13 and end with 100 along with this of counter "20130613" also increases per command as the next command should be ... (8 Replies)
Discussion started by: kaushik02018
8 Replies

9. Shell Programming and Scripting

How to execute a command inside a while loop?

How do we execute a command inside a while loop? (7 Replies)
Discussion started by: Little
7 Replies

10. Shell Programming and Scripting

Exit while loop on execute script

Hi, I have first script which on IR remote command event execute the second script. If the second script is executed, it display echo "timeout expired" after 10s. This works as expected. But I also want to reset timer (increase time) in case if the second script is executed again within 10s. ... (8 Replies)
Discussion started by: armatron
8 Replies
Expression(3pm) 					User Contributed Perl Documentation					   Expression(3pm)

NAME
Math::Calculus::Expression - Algebraic Calculus Tools Expression Class SYNOPSIS
use Math::Calculus::Expression; # Create an expression object. my $exp = Math::Calculus::Expression->new; # Set a variable and expression. $exp->addVariable('x'); $exp->setExpression('x^(2+1) + 6*5*x') or die $exp->getError; # Simplify $exp->simplify or die $exp->getError;; # Print the result. print $exp->getExpression; # Prints x^3 + 30*x DESCRIPTION
This module can take an algebraic expression, parse it into a tree structure, simplify the tree, substitute variables and named constants for other variables or constants (which may be numeric), numerically evaluate the tree and turn the tree back into an output of the same form as the input. It supports a wide range of expressions including the +, -, *, / and ^ (raise to power) operators, bracketed expressions to enable correct precedence and the functions ln, exp, sin, cos, tan, sec, cosec, cot, sinh, cosh, tanh, sech, cosech, coth, asin, acos, atan, asinh, acosh and atanh. EXPORT
None by default. METHODS
new $exp = Math::Calculus::Expression->new; Creates a new instance of the expression object, which can hold an individual expression and perform basic operations on it. addVariable $exp->addVariable('x'); Sets a certain named value in the expression as being a variable. A named value must be an alphabetic chracter. setExpression $exp->setExpression('x^2 + 5*x); Takes an expression in human-readable form and stores it internally as a tree structure, checking it is a valid expression that the module can understand in the process. Note that the module is strict about syntax. For example, note above that you must write 5*x and not just 5x. Whitespace is allowed in the expression, but does not have any effect on precedence. If you require control of precedence, use brackets; bracketed expressions will always be evaluated first, as you would normally expect. The module follows the BODMAS precedence convention. Returns undef on failure and a true value on success. getExpression $expr = $exp->getExpression; Returns a textaul, human readable representation of the expression that is being stored. simplify $exp->simplify; Attempts to simplify the expression that is stored internally. evaluate $exp->evaluate(x => 0.5, a => 4); This method takes a hash mapping any variables and named constants (represented by letters) in the expression to numerical values, and attempts to evaluate the expression and return a numerical value. It fails and returns undef if it finds letters that have no mapping or an error such as division by zero occurs during the evaluation. sameRepresentation $same = $exp->sameRepresentation($exp2); The sameRepresentation method takes another expression object as its parameter and returns true if that expression has the same internal representation as the expression the method is invoked on. Be careful X while it can be said that if two expressions have the same representation they are equal, it would be wrong to say that if they have different representations they are not equal. It is clear to see that "x + 2" and "2 + x" are equal, but their internal representation may well differ. clone $expCopy = $exp->clone; The clone method returns a deep copy of the expression object (deep copy meaning that if the original is modified the copy will not be affected and vice versa). getTraceback $exp->getTraceback; When setExpression and differentiate are called, a traceback is generated to describe what these functions did. If an error occurs, this traceback can be extremely useful in helping track down the source of the error. getError $exp->getError; When any method other than getTraceback is called, the error message stored is cleared, and then any errors that occur during the execution of the method are stored. If failure occurs, call this method to get a textual representation of the error. Other Methods Any other method call is taken to refer to a subclass of Expression. The first letter of the name of the method invoked is capitalized, then a module by that name is loaded (if it exists) and the method is called on it. This works for, for example, the Differentiate module; calling the differentiate method on an Expression will load the Differentiate module and call the differentiate method. If a module cannot be loaded or the method cannot be called, then this module will die. SEE ALSO
The author of this module has a website at <http://www.jwcs.net/~jonathan/>, which has the latest news about the module and a web-based frontend to allow you to try out this module and, more specifically, its subclasses. AUTHOR
Jonathan Worthington, <jonathan@jwcs.net> COPYRIGHT AND LICENSE
Copyright (C) 2004 by Jonathan Worthington This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 57: '=item' outside of any '=over' Around line 398: You forgot a '=back' before '=head1' perl v5.10.0 2005-07-30 Expression(3pm)
All times are GMT -4. The time now is 09:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy