Thread: Running commands in loop??
-
July 23rd, 2008, 11:58 PM #1Junior Member
- Join Date
- Jul 2008
- Posts
- 1
Running commands in loop??
Hi All,
I want to execute a set of commands in unix in sequence.
say,
sh ABC.sh job1 20010505 C/..../log
sh ABC.sh job1 20010506 C/..../log
sh ABC.sh job1 20010507 C/..../log
sh ABC.sh job1 20010508 C/..../log
..
How i can write a loop to execute these commands one after another in sequence.
Also, untill the first command is runs completely, the second should not get executed.
The only variant in all these commands is the date.
I am just learning unix scripts...if someone could pitch in with their suggestions it would be great..!!
Regards,
Bruce
-
July 24th, 2008, 12:29 PM #2
I'm not a Unix scripting expert but I'll give it a shot.
So do you want to run them in a loop one at a time repeatedly? Or just run them one at a time once per execution of the script?
If you just want to run them once per execution, just type them into the script file, one per line. Don't forget any script headers that are needed. I think they will run one at a time, waiting for the previous one to finish before starting the next.
If you want to have them run repeatedly, you'll need to use some type of FOR loop in the scripting.
-
September 10th, 2008, 01:09 AM #3Junior Member
- Join Date
- Sep 2008
- Posts
- 3
while [ 1 ]; do
command1
command2
....
done
-
September 11th, 2008, 11:45 PM #4those are tick marks - not quote marks.Code:
for i in `ls 20010*`;do sh ABC.sh job1 $i C/..../log;done
Odds are very good there are several spelling mistakes in this post.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Having problems with running games with TeamSpeak, can't speak while running
By Naga in forum Technical SupportReplies: 0Last Post: March 22nd, 2007, 09:23 PM -
what do these commands do?
By gigahertz205 in forum Networking and InternetReplies: 4Last Post: March 7th, 2005, 08:46 PM -
Which Commands ?
By Regulus in forum Applications and Operating SystemsReplies: 11Last Post: October 29th, 2004, 09:13 PM -
commands
By maotx in forum General Tech DiscussionReplies: 6Last Post: June 20th, 2003, 09:07 AM -
Linux Commands
By ridemonkey in forum Webmastering and ProgrammingReplies: 6Last Post: September 10th, 2002, 10:15 AM



LinkBack URL
About LinkBacks



Reply With Quote



Taking advice from you would be like accepting a dinner invitation from Hannibal Lecter -- with the difference that he's smart. How's this? When I took the course several years ago, I discovered...
Happy Sequester Furlough Friday!