$ cat -n exitReturnBug.sh 1 #!/usr/bin/bash 2 function shouldReturnFalse() { 3 false 4 return 5 } 6 trap 'shouldReturnFalse && echo "woops"' EXIT $ ./exitReturnBug.sh woops
If I change line 4 to "return $?" it will not print "woops" which is the correct behavior.
I tested this in 5.0.17 and 5.1.16. --BobG