|
From: | Robert E. Griffith |
Subject: | return exit code in EXIT trap |
Date: | Tue, 2 Aug 2022 15:38:01 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 |
$ cat -n exitReturnBug.sh 1 #!/usr/bin/bash 2 function shouldReturnFalse() { 3 false 4 return 5 } 6 trap 'shouldReturnFalse && echo "woops"' EXIT $ ./exitReturnBug.sh woopsIf 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
[Prev in Thread] | Current Thread | [Next in Thread] |