I have such a bash file;
./process1
./process2
./process3
./process4
./process5
Let's say I run this bash script, and process2
is killed for some reason. Without passing to process3
, I directly want to exit. How can I manage this?
Thanks,
I have such a bash file;
./process1
./process2
./process3
./process4
./process5
Let's say I run this bash script, and process2
is killed for some reason. Without passing to process3
, I directly want to exit. How can I manage this?
Thanks,
Just exit if non-zero exit code:
./process1 || exit
and so on ...
Another way in bash
, use -e
flag:
#!/bin/bash
set -e
-e Exit immediately if a command exits with a non-zero status.
You can try it so:
./process1 && ./process2 && ./process3 && ./process4 && ./process5