I have a shell script containing trap, but trap doesn't seems to work as expected below is the code and bash version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
set -e function exit_message(){ echo -e "\e[31m\nError occurred " } function login(){ false } trap exit_message ERR login Above trap works if I do
function login(){ trap exit_message ERR false }
set -eis complete without a link to this table ;-)