gibney.org : Technology : Programming : BASH : Error handling


just a logo :)

search:


See as: raw | code

terms of service | imprint

gibney.org
is powered by m1d1





Error handling
(Entry Nr. 177, by user 1 | edit)
Put this line in a shellscript, and the rest of the script will terminate on any error:

set -e

Another - rather undocumented - way. It wont work if your script uses subshell stuff (putting commands in parenthesis) but you can define an error handling function:

trap 'echo error trapped!;exit 1' err;
Create a new entry at this position