Chris
Chris

Reputation: 5617

Can One Bash Script Launch Multiple Other Bash Scripts?

I currently have a Bash Script ("Bash Script 1") that executes a PHP file. I would like to have a Bash script that can launch multiple instances of "Bash Script 1" and let them run at the same time.

Is this possible and how might I go about this?

Any thoughts or comments would be greatly appreciated.

Upvotes: 0

Views: 456

Answers (2)

Diego Torres Milano
Diego Torres Milano

Reputation: 69188

If you want to repeat the same command:

N=10 # number of repetitions
for i in $(seq $N)
do
    bash_script_1&
done

Upvotes: 1

Barmar
Barmar

Reputation: 780688

Run them in the background, just like you would in an interactive shell.

command1 &
command2 &
command3 &
wait # Wait for all background commands to finish

The commands can be just about anything, not just other bash scripts.

Upvotes: 7

Related Questions