Running several scripts in parallel bash script [duplicate] Running several scripts in parallel bash script [duplicate] bash bash

Running several scripts in parallel bash script [duplicate]


Using the & to run it in the background will do the trick

cppcheck.sh &churn.sh &run.sh &waitecho "All 3 complete"

It will fork off a new process for each of them.

The bash wait will also come in handy as stated in the comments, if you have something to be run on the parent script, after these three finish.

Without an argument it will wait for all child processes to complete, and then resume execution of the parent script.


The issues you are facing seem to be directly related to this. Variables set are only visible to the sub-shell in which they are defined. So, if you have OUT_DIR specified in the parent script, it won't be visible to the child script when it forks off. The right thing to do in this case would be to export the variable as an environment variable.