-   Programming (
-   -   bash script loop (

bong.mau 09-14-2005 03:48 PM

bash script loop

i'm new to linux...

i 'm building a bash script to automate some jobs & commands....
i need to check n times a condition and then exit...
the below example i think will repeat a cycle 5 times.....
for i in 1 2 3 4 5
echo "Welcome $i times"

then does not matter what instructons i will put insiede the do - done

now the question...if i have to repeat a loop to check a condition 100 times
what is the syntax ?
i have to specify all the numbers from 1 to 100 in the for instruction
or there is something like..... "for 1 to 100"
then in another thread i opened ,it was suggested me to learn about
script looking into some guides....
these guides are useful,but i still have not found a reference guide of the
bash script language....
a reference where i can look to the "for" instruction and see the syntax ....
sumarizing ....... i need to know if there is a simplier syntax about the
sample code to repeat 100 times...and if there is a reference book about bash script language..a book where all the instruction are listed in alphabetical order...
thanks in advance


bong.mau 09-14-2005 03:54 PM

to be more clear
i need to check if pgm is startet
the check must be repeated 5 times
for ..... (repeat 5 times)
sleep 2
ps -e | grep pppd

david_ross 09-14-2005 03:56 PM

You can use this syntax too:
echo $i

bong.mau 09-14-2005 04:00 PM


david i think my example in the forst update is misleading.....(sorry ..i done a mistake putting this example i find on internet site....)
really what i need is to repeat n times the loop in the second post

david_ross 09-14-2005 04:15 PM

Just use 5 rather than 100 then.

Dave Kelly 09-14-2005 06:09 PM

chrism01 09-14-2005 07:38 PM

All times are GMT -5. The time now is 02:57 AM.