This was tested on bash 4.3.22 (HP-UX) and bash 4.2.37 (Linux).

Create a script named foo with the following content:

#!/bin/bash
set -m
while sleep 1; do :; done

Make it executable, and type

./foo &

at an interactive shell.  You get your shell prompt back.  You can press
Enter as many times as you like.  But if you press any key other than
Enter, the entire terminal window goes away.

Wrapping a few shells around it only postpones the inevitable.  If you
run a few nested "bash" shells as padding, and then run ./foo & in the
innermost one, each non-Enter keystroke will kill one instance of bash,
printing the word "exit" on the terminal.  When all the shells die,
so does the terminal.

wooledg@wooledg:~$ bash
wooledg@wooledg:~$ bash
wooledg@wooledg:~$ bash
wooledg@wooledg:~$ bash
wooledg@wooledg:~$ ./foo &
[1] 11945
wooledg@wooledg:~$ aexit
wooledg@wooledg:~$ bexit
wooledg@wooledg:~$ cexit
wooledg@wooledg:~$ dexit
wooledg@wooledg:~$ 

(The next keystroke after that removes the terminal.)

Reply via email to