Kill follow-on code if source fails in bash?
I have a Bash script that runs other bash scripts. If the parent code fails, is there any way for me to also kill the child code?
For instance, I have this script: Code:
#!/bin/sh |
Quote:
.andy |
What does this have to do with source? Is that how it runs the other scripts? You might be able to use kill 0, but only if the child processes are "good" and didn't create their own process groups or sessions.
Kevin Barry |
It's easier than you think.
On the command-line: make depend && make && make install ... will execute each of these three commands in turn, stopping short if any of them do not succeed. It's not that the following commands are "killed," but rather that they "are not launched." There is, of course, "more than one way to do it." |
All times are GMT -5. The time now is 03:48 PM. |