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
to be more clear
i need to check if pgm is startet
the check must be repeated 5 times
for ..... (repeat 5 times)
ps -e | grep pppd
You can use this syntax too:
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
Just use 5 rather than 100 then.
|All times are GMT -5. The time now is 04:48 PM.|