I recently ran into a strange behavior. Trap doesn't get executed if inside grouping command:
$ cat ./1.sh
#!/usr/bin/env bash
set -eu
trap 'echo exit' EXIT
$ ./1.sh
exit
$ cat ./2.sh
#!/usr/bin/env bash
set -eu
echo test | { trap 'echo exit' EXIT; }
$ ./2.sh
Is it as it's supposed to be?
bash-4.3.8
, and doesn't work inbash-4.2.37
. If you answer my question, I'll accept it. Also, it'd interesting to know in which version/commit it was fixed. The bug report you mentioned doesn't tells anything about it. – x-yuri Jun 27 at 13:10