bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Script with set -m launched from interactive shell makes all ancestor sh


From: Greg Wooledge
Subject: Script with set -m launched from interactive shell makes all ancestor shells die
Date: Wed, 13 Aug 2014 12:42:30 -0400
User-agent: Mutt/1.4.2.3i

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.

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

(The next keystroke after that removes the terminal.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]