linux - Aborting a shell script if any command returns a non-zero value? -
I have a bass shell script which invokes several commands, I think the shell script automatically returns 1 The value wants to get out of it if any order returns zero-zero values.
Is this possible without checking the result of each order clearly?
For example
dosomething1 if [[$? -a 0]]; So exit 1 dosomething2 if the [[$? -a 0]]; Then add it to the beginning of the script:
Add it:
set -e This would be the reason to get out of the shell immediately if a simple order exits from a noose's exit value. A simple order is not a part of any command, unless, until, or until the trial, or any & amp; Amp; Or || List
See "Set" on internal commands for more information.
I personally started almost all shell scripts with "Set-A".
Comments
Post a Comment