I can see there is parallel command which can do similar to what I want and answer is here: run commands in parallel with exit fail if any command fails
But I am using very minimal vm image and so I can't use parallel
.
So Is that possible to run commands in parallel and return exist status fail if any of the command fails in the batch.
Ex.
(npm install --global bower ng-cli) & (cd $1 npm install) & (cd $2 bower install); wait
In the above command if 2nd command fails, it should return exit status fail.
Please let me know if I should provide any more information.
(Worst case) if someone can help me converting above command to parallel command that will be also useful.
Using GNU Parallel:
parallel --halt now,fail=1 ::: \
"npm install --global bower ng-cli" \
"cd $1 npm install" \
"cd $2 bower install" && echo All is OK
It will return with failure as soon as one of the jobs fail.