Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to run the following commands in parallel with 1 shell script.

coffee -wc lib/
coffee -wcb public/

Currently, I have to press ctrl+c to cancel out of the first one before the second line can execute.

Any ideas would be greatly appreciated!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

This will run both simultaneously.

   # coffee -wc lib/ && coffee -wcb public/

UPDATE: As per Dennis and Neurolysis's comment, I'm changing the answer to use an &. Although both commands are similar, the && operator will cause the 2nd command to be run only after the first is completed.

 ## print 'program1', wait 4 seconds, print 'program2'
 # echo 'program1';sleep 4 && echo 'program2'

 ## print 'program1' and sleep, but also simulatneously print 'program2'
 # echo 'program1';sleep 4 & echo 'program2'

Thus, the technically correct answer is:

 # coffee -wc lib/ & coffee -wcb public/
share|improve this answer
    
Unless coffee executes much differently than I'm used to, won't this merely do 'execute on success' rather than 'execute simultaneously'? –  Matthieu Cartier Jan 9 '11 at 12:39
    
I should be a single ampersand. –  Dennis Williamson Jan 9 '11 at 15:35
    
thanks for the updates guys! –  resopollution Jan 11 '11 at 4:01
    
You're welcome. Glad to be able to help and also learn something new at the same time. –  jmort253 Jan 11 '11 at 7:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.