Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I write a shell script something like this:

php script1.php
php script2.php

What happens when I run it? Does shell wait until script1.php has finished before moving onto php script2.php or does the 2nd line get ran immediately after the first?

If the latter, how can I get it to behave like the former?

share|improve this question
up vote 0 down vote accepted

All shell commands are executed sequentially and each command is executed after finishing the previous one unless you run a command in the background by appending ampersand & at the end of the command.

share|improve this answer
Thanks very much – Lucas Scholten Sep 16 '12 at 13:15

Your Answer


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.