Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to run files of same spelling except numbering

Status
Not open for further replies.

ronfarris

Programmer
Oct 25, 2000
30
0
0
US
Does anyone know how to run a script with the same spelling where only the numbers are different. I can easily make a script that will run each separate file individually, however, since the files are exactly the same except for the last digits, example(runthis0, runthis1,...runthis31), rather than writing in the script each separate filename. Example of script

runthis0 &&
runthis1 &&
runthis31 &&

Is there a wildcard that I can use that will call up each of these files without type a new line for each file or script?
for instance runthis&* or something.

Would greatly appreciate your assistance.
Thank you in advance.
Ron
 
Hi ron

You may aleady know this, but have you tried to use a for loop

for filename in `ls run*`
do

May work.




Nadim

 
I guess is better for you to run
[tt]
for SCRIPTN in run[0-9]*
do
[red]$SCRIPTN & [/red]
done
[/tt]

I hope it works...
I hope it works...
Unix was made by and for smart people.
 
Hi Everyone and thank you for your help. I couldn't get this to work but thank you anyway.
 
Ron,

Elgis' script looked like it should work -- what error message or result did you get? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Maybe you need to use
[tt]
for SCR in run[0-9]*
do
chmod u+x $SCR
[red]./[/red]$SCR
done
[/tt]


I hope it works...
Unix was made by and for smart people.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top