Sponsored Content
Full Discussion: Simple while-loop problem
Top Forums Shell Programming and Scripting Simple while-loop problem Post 302439591 by Scott on Friday 23rd of July 2010 05:39:33 AM
Old 07-23-2010
Hi.

Arithmetic operations are done with -lt, -eq, -gt, etc.

So...

Code:
while [ $i -lt 20  ]

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

a simple while loop

Hallo everyone I might just be being dumb, but I am using the BASH shell and cannot get the following script to work: x=0 while do echo $x x=´echo "$x + 1" | bc´ done Can anybody help me out. I am just get a repeating output saying: bc: command not found 0 + 1: command not... (5 Replies)
Discussion started by: syno
5 Replies

2. Shell Programming and Scripting

Simple bash for loop problem

I'm just trying to make a script that runs in command line to echo each line in a text file. Everything i found on google is telling me to do it like this but when I run it it just echos removethese.txt and thats it. Anyone know what im doing wrong? for i in removethese.txt; do echo $i; done ... (4 Replies)
Discussion started by: kingdbag
4 Replies

3. 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

4. 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

5. 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

6. Shell Programming and Scripting

Simple using For loop

Hi expert, I'm using csh Code: #!/bin/csh set x = 0 set number = `awk '{array=$0} END {print array;}'` i want to use for loop to store data to $number repeatly untill x = 23 How to use c shell for loop? (2 Replies)
Discussion started by: vincyoxy
2 Replies

7. UNIX for Dummies Questions & Answers

Simple loop

I need to chmod a bunch of files with a specific extension in one directory. If I understand correctly first I would run ls command like this ls -R | grep .mp3 > /tmp/list once I have the output file I should be able to run a loop to chmod all the files in the list created. This is where... (5 Replies)
Discussion started by: eugenes18t
5 Replies

8. 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

9. Shell Programming and Scripting

a simple loop

Does any body can help me with a loop in this example? if then if then runner=$(grep "$1" "$2") runne=$(grep "$1" "$3") run=$(grep "$1" "$4") fi fi # # Message on screen... (3 Replies)
Discussion started by: bartsimpsong
3 Replies

10. 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
Set::Infinite::Arithmetic(3pm)				User Contributed Perl Documentation			    Set::Infinite::Arithmetic(3pm)

       NAME

       Set::Infinite::Arithmetic - Scalar operations used by quantize() and offset()

       AUTHOR

       Flavio Soibelmann Glock - fglock@pucrs.br

       %_MODE hash of subs

	   $a->offset ( value => [1,2], mode => 'offset', unit => 'days' );

	   $a->offset ( value => [1,2, -5,-4], mode => 'offset', unit => 'days' );

       note: if mode = circle, then "-5" counts from end (like a Perl negative array index).

	   $a->offset ( value => [1,2], mode => 'offset', unit => 'days', strict => $a );

       option 'strict' will return intersection($a,offset). Default: none.

       %subs_offset2($object, $offset1, $offset2)

	   &{ $subs_offset2{$unit} } ($object, $offset1, $offset2);

       A hash of functions that return:

	   ($object+$offset1, $object+$offset2)

       in $unit context.

       Returned $object+$offset1, $object+$offset2 may be scalars or objects.

       %Offset_to_value($object, $offset)

       %Init_quantizer($object)

	   $Offset_to_value{$unit} ($object, $offset);

	   $Init_quantizer{$unit} ($object);

       Maps an 'offset value' to a 'value'

       A hash of functions that return ( int($object) + $offset ) in $unit context.

       Init_quantizer subroutines must be called before using subs_offset1 functions.

       int(object)+offset is a scalar.

       Offset_to_value is optimized for calling it multiple times on the same object, with different offsets. That's why there is a separate
       initialization subroutine.

       $self->{offset} is created on initialization. It is an index used by the memoization cache.

perl v5.10.0							    2008-06-21					    Set::Infinite::Arithmetic(3pm)
All times are GMT -4. The time now is 10:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy