I have a simple script
trap 'echo exit' EXIT
while true; do sleep 1; done
and it behaves differently in different shells:
$ bash tst.sh
^Cexit
$ dash tst.sh
^C
$ zsh tst.sh
^C
$ sh tst.sh
^Cexit
So I'm not sure about how it should operate and whether it is specified at all.
EXIT
trap isn't working the same way in every shell. A few examples:exit
.I'd suggest you to actually catch the signals and then exit, it should be portable across most shells: