home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Linux and Unix
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1761
Discussions: 186,638, Posts: 2,227,428, Members: 230,267
Free Scan: Update Your PC's Outdated Drivers to Optimize Performance
Old July 24th, 2008, 12:58 AM   Digg it!   #1 (permalink)
Junior 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

brucewayne is offline   Reply With Quote
TechIMO.com Ads - Login or register for less ads.
How many errors does your computer have?

You no longer need to guess! This free stability scan and registry cleaner download will give you a complete diagnosis of your Windows registry, identifying errors and conflicts.

FREE instant scan


Guest, Register Free! to remove this ad and get your tech support questions answered in minutes!
Old July 24th, 2008, 01:29 PM     #2 (permalink)
Ultimate Member
 
SeanC's Avatar
 
Join Date: Oct 2001
Location: Toronto Canada
Posts: 4,619
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.
__________________
AMD Phenom Q9500 Quad-Core 2.2ghz / Asus M3A78-EMH HDMI / 4GB PC667 RAM / 320GB SATA II
Debian Lenny AMD64 version

SeanC is offline   Reply With Quote
Old September 10th, 2008, 02:09 AM     #3 (permalink)
Junior Member
 
Join Date: Sep 2008
Posts: 3
while [ 1 ]; do
command1
command2
....
done

trueg is offline   Reply With Quote
Old September 12th, 2008, 12:45 AM     #4 (permalink)
Ultimate Member
 
pbharris's Avatar
 
Join Date: Oct 2001
Location: Chicago, IL
Posts: 2,513
Send a message via ICQ to pbharris Send a message via AIM to pbharris Send a message via Yahoo to pbharris
Code:
for i in `ls 20010*`;do sh ABC.sh job1 $i C/..../log;done
those are tick marks - not quote marks.
__________________
Odds are very good there are several spelling mistakes in this post.
pbharris is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Having problems with running games with TeamSpeak, can't speak while running Naga Technical Support 0 March 22nd, 2007 10:23 PM
what do these commands do? gigahertz205 Networking and Internet 4 March 7th, 2005 08:46 PM
Which Commands ? Regulus Applications and Operating Systems 11 October 29th, 2004 10:13 PM
commands maotx General Tech Discussion 6 June 20th, 2003 10:07 AM
Linux Commands ridemonkey Webmastering and Programming 6 September 10th, 2002 11:15 AM

Most Active Discussions
Is It Just Me? (581)
Putting together my wish list (14)
First Time PC Builder (14)
Back to the Workouts (835)
Motherboard compatibiltiy for 9600 .. (5)
RAID 0 External Drive Slow/Failing .. (12)
Supply Side vs. Demand Side economi.. (11)
Folderchat: The Holiday thread (149)
heatsink issue (17)
Recent Discussions
Looking for some help (0)
soulstrom russian version (0)
SSD's, RAID, and External Backu.. (8)
virtual memory (0)
Contest: Logo and Banner design.. (6)
Putting together my wish list (14)
Giga Pocket Junk (0)
Folderchat: The Holiday thread (149)
First Time PC Builder (14)
Magellan RoadMate 1412 GPS Perf.. (2)
FS: Dell 6000 laptop, modded 36.. (2)
Apple iPod touch 16 GB $200 (4)


All times are GMT -4. The time now is 01:58 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28