I have a shell script of the following format :
cd /path/a/
make
cd /path/b/
make
cd /path/c/
make
Each of the make commands are independent of each other in different directories. I would like to speed up the script by running the different make commands in background using '&'
cd /path/a/
make &
cd /path/b/
make &
cd /path/c/
make &
Would this work? While the first make command is running, the directory has changed to /path/b/ in the next line. Will this affect the first make commend in the background?
Edit: I am doubtful if this method would actually make this process faster, and wonder if these need to be run in separate processes.