This looks correct to me: me@myhost>$ bash me@myhost>$ export PS1='Prompt> '; trap 'echo I' int; (while kill -int $$; do sleep 1; done) & [1] 65437 Irompt> ^C //// "^C" printed by kernel/bash on receipt of SIGINT
Irompt> ^C Irompt> ^C Prompt> ////here I press ^D and exit bash started in 1st line of the example exit me@myhost>$ bash: line 1: kill: (65408) - No such process Now the same but with SIGTERM: me@myhost>$ bash me@myhost>$ export PS1='Prompt> '; trap 'echo T' term; (while kill $$; do sleep 1; done) & [1] 65964 Prompt> exit me@myhost>$ bash: line 1: kill: (65904) - No such process without me pressing anything. Why did bash exit?! The trap does not contain any 'exit' commands! bash --version GNU bash, version 5.3.9(1)-release (x86_64-redhat-linux-gnu)
