The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed command not running mmunir Shell Programming and Scripting 3 04-17-2008 11:02 PM
running files Enduser UNIX for Dummies Questions & Answers 1 10-06-2007 11:42 AM
inconsistent ls command display at the command prompt & running as a cron job rajranibl Linux 5 07-30-2007 05:26 AM
running command more than twice in one second? Terrible Shell Programming and Scripting 4 12-10-2006 08:45 PM
Running EXE files on UNIX seanstog UNIX for Dummies Questions & Answers 1 02-05-2002 02:19 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-15-2005
Registered User
 

Join Date: Oct 2005
Posts: 4
Stumble this Post!
Question running files consecutively with one command

i want to run few c object files one after another in one command. Can i write a acript for that. I'm using Sun Solaris.
for example

./prog < input1 >output1 &
./prog <input2 >output2 &

i want the first to finish before starting the nest one and run them in the back ground

thanks.
p/s hope fully this is the right thread to ask
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-15-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,445
Stumble this Post!
( ./prog < input1 >output1 ; ./prog < input2 >output2 ) &
Reply With Quote
  #3 (permalink)  
Old 10-15-2005
Registered User
 

Join Date: Oct 2005
Posts: 4
Stumble this Post!
Smile What if i have more than 10 files?

can i write a script for that so that
1. I can change the parameter
2. I don't have to retype all again everytime...

thanks.
Reply With Quote
  #4 (permalink)  
Old 10-15-2005
Registered User
 

Join Date: Oct 2005
Posts: 4
Stumble this Post!
running from different directory

say i have three executable code from three directory,
I want to run them consecutively as i have posted before from the main directory.
i tried ( /program1/./prog <input >output; /program2/./prog <input >output)&

if give me error no such files or directory

thanks...
Reply With Quote
  #5 (permalink)  
Old 10-15-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,445
Stumble this Post!
You can put that syntax in a script and use variables with it, etc. Not limited to 2 programs. With 10, you might switch to:

(
./prog < input1 >output1
./prog < input2 >output2
) &
Reply With Quote
  #6 (permalink)  
Old 10-15-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,445
Stumble this Post!
Quote:
Originally Posted by narom
say i have three executable code from three directory,
I want to run them consecutively as i have posted before from the main directory.
i tried ( /program1/./prog <input >output; /program2/./prog <input >output)&

if give me error no such files or directory

thanks...

Well then the file it complained about must not exist. "/program1/./prog" is silly. Just use "/program1/prog" and that file must exist. If you can't do:
/program/prog
then putting it in parenthesis will not help.

Do Not Omit Spaces!

output)&
that is not what I used.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0