Sponsored Content
Full Discussion: Simple LOOP script help
Top Forums Shell Programming and Scripting Simple LOOP script help Post 302340403 by wpeckham on Monday 3rd of August 2009 10:16:58 AM
Old 08-03-2009
Loop

Why not something simple, like
for foo in 0 1 2 3 4 5 6 7 8 9 10 ; do
echo "Count is ${foo} "
pwd
ls -l
sleep 30
done


if you are going to iterate over a known and manageable range like this, for MAY be more appropriate than while.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simple script loop question

Hey all. Thanks in advance for any help you can give, hopefully this is an easy one. I want to create a loop to run a simple performance monitor like vmstat and record it to a file, but have very limited scripting skills (obviously). Starting with this... date >> /var/log/perfmon.log vmstat... (2 Replies)
Discussion started by: mattlock73
2 Replies

2. Shell Programming and Scripting

simple for loop

i have the following process running in background: when i give "ps -lef" ------------------------------------------------------------------------ user2 user1 user1 user3 user1 user4 user5 user4 user3 user4 user2 user1 user1 user3 user1 user4 (3 Replies)
Discussion started by: ali560045
3 Replies

3. Shell Programming and Scripting

simple while loop

i have a script called file2 #!/bin/ksh i=0 while do echo $i >> result.txt i=`expr $i + 1` done echo "***********************" >> result ------------------------------------------------------------------- (10 Replies)
Discussion started by: ali560045
10 Replies

4. Shell Programming and Scripting

A simple (?) loop

I have what I believe is a simple programming question. I have a text file that looks like: mol 1 G:\stereo01.hin block text ... ... ... endmol 1 However, I would like a file that repeats this entire block of text several times over. The lines of text in the middle remain the same for each... (2 Replies)
Discussion started by: red baron
2 Replies

5. UNIX for Dummies Questions & Answers

simple script with while loop getting problem

Hello forum memebers. can you correct the simple while program. #! /bin/ksh count=10 while do echo $count count='expr$count-1' done I think it will print 10 to 1 numbers but it running for indefinite times. (2 Replies)
Discussion started by: rajkumar_g
2 Replies

6. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

7. Shell Programming and Scripting

Simple loop using for

Dear experts, I am writing a bash script. At some point of the program I need to have 'for' loop. For simplicity I tried with some other simple code. The format of the loop is given below. k=51 m=55 for j in {$k..$m};do w=$(($j+2)) z=$(($j+9)) echo "$w, $z" done But my... (4 Replies)
Discussion started by: vjramana
4 Replies

8. Shell Programming and Scripting

simple while loop script to check a connection

Hi, I am completely new to shell scripting. Basically I am wanting to create a simple while loop script to check if a network connection is available from 'netstat -a' and if its present then output a character to the serial port. I think i am nearly there.. but need some assistance.. this is... (9 Replies)
Discussion started by: zippyzip
9 Replies

9. Shell Programming and Scripting

[Solved] Simple script not working- for loop

Hi all, Please guide me writing this script Follwing is the file which I have created, which contains the files to be copied. cat system1-dr.txt /etc/passwd /etc/shadow /etc/group /etc/vfstab /etc/profile /etc/default/init /etc/shells /etc/dfs/dfstab /etc/dfs/sharetab... (11 Replies)
Discussion started by: manalisharmabe
11 Replies

10. Shell Programming and Scripting

Help with simple bash script involving a loop

Dear unix wizards, I'd be very grateful for your help with the following. I have a hypothetical file (file.txt) with three columns: 111 4 0.01 112 3 0.02 113 2 0.03 114 1 0.04 115 1 0.06 116 2 0.02 117 3 0.01 118 4 0.05 Column 2 consists of pairs of integers from 1 to 4 (each... (5 Replies)
Discussion started by: aberg
5 Replies
CLASSKIT_METHOD_REDEFINE(3)						 1					       CLASSKIT_METHOD_REDEFINE(3)

classkit_method_redefine - Dynamically changes the code of the given method

SYNOPSIS
bool classkit_method_redefine (string $classname, string $methodname, string $args, string $code, [int $flags = CLASSKIT_ACC_PUBLIC]) DESCRIPTION
Note This function cannot be used to manipulate the currently running (or chained) method. Warning This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. PARAMETERS
o $classname - The class in which to redefine the method o $methodname - The name of the method to redefine o $args - Comma-delimited list of arguments for the redefined method o $code - The new code to be evaluated when $methodname is called o $flags - The redefined method can be CLASSKIT_ACC_PUBLIC, CLASSKIT_ACC_PROTECTED or CLASSKIT_ACC_PRIVATE Note This parameter is only used as of PHP 5, because, prior to this, all methods were public. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 classkit_method_redefine(3) example <?php class Example { function foo() { return "foo! "; } } // create an Example object $e = new Example(); // output Example::foo() (before redefine) echo "Before: " . $e->foo(); // Redefine the 'foo' method classkit_method_redefine( 'Example', 'foo', '', 'return "bar! ";', CLASSKIT_ACC_PUBLIC ); // output Example::foo() (after redefine) echo "After: " . $e->foo(); ?> The above example will output: Before: foo! After: bar! SEE ALSO
classkit_method_add(3), classkit_method_copy(3), classkit_method_remove(3), classkit_method_rename(3). PHP Documentation Group CLASSKIT_METHOD_REDEFINE(3)
All times are GMT -4. The time now is 09:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy