how to run script multiple times

I have a script that needs to either loop 100 times from start to finish or needs to be exicuted 100 times. This script is getting run through cron at a specific time. For now I have pointed my cron job to another script that has 100 lines calling up the script I need to run. This is not practical at all. Basically somthing like this would be nice
#100x ./script-name.sh
Or some kind of variable in the script itself that loops from start to finish 100 times.

Thanks,
DMS
LVL 1
DMS-XAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

avizitCommented:
#!/bin/bash
 COUNTER=0
 while [  $COUNTER -lt 100 ]; do
             /path/to/your/script            
             let COUNTER=COUNTER+1
 done
0
avizitCommented:
BASH Programming - Introduction HOW-TO
7. Loops for, while and until

http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html
0
DMS-XAuthor Commented:
GRRRR I thought for sure with bash it would be easier than this.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

nagravesCommented:
avizit's method works fine..

put their script in say: ~/counter.sh
chmod +x counter.sh

make your crontab call ~/counter.sh

This will run your other script 100 times when crontab kicks in and runs counter.sh.
0
nagravesCommented:
Or alternately, you can remove the          /path/to/your/script          and put your entire script in the middle of the looping structure.
0
byttaCommented:
It can't get much easier than this.
The "cleanest" version (the one with the least characters) is:

 #!/bin/bash
for i in $(seq 100)
             /path/to/your/script            
done

but it all works the same...
0
da99rmdCommented:
You can make it more general by adding this:
#!/bin/bash
# ./runTimes <nrOf> <app>
for i in $(seq $1)
do
             $2            
done

/R
0
goldwarlockCommented:
There's a program called 'anacron'. Very powerful and mature - allows you to run any command/script/program multiple times.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.