Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there any way to make GNU Screen not close if I end all its subprocesses? Ideally, it would create a new window running a shell if I accidentally closed the last window.

share|improve this question

2 Answers 2

up vote 8 down vote accepted

Assuming you're using bash and accidentally closes the shell with Ctrl-D, you can

export IGNOREEOF=1

This will give you a warning and require you to press Ctrl-D twice, or type exit instead.

share|improve this answer
3  
Thanks! I added this to my ~/.screenrc: setenv IGNOREEOF 10 / screen -t main bash / unsetenv IGNOREEOF –  P-Nuts Jun 24 '11 at 15:40
1  
+1 because there's no part of my life that hasn't been improved after learning that! –  EightBitTony Jun 24 '11 at 16:09
1  
I did some more investigation and if you search for "Suddenly the Dungeon collapses!!" in attacher.c, it should be possible to change the code to spawn a new window somehow, instead of shutting down the whole thing. The source is just one quick git clone away: git://git.sv.gnu.org/screen.git –  Alexander Jun 24 '11 at 16:47
1  
Haha! I don't really want to go to the effort of maintaining my own patch to Screen, but thanks for reminding me of the Nethack option. (Though I was more of an Angband man myself...) –  P-Nuts Jun 24 '11 at 22:18

I don't know of a way to do that specifically, but I find zombie {} useful; when I close a window, it prompts me to hit { or } to close or reopen it, respectively.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.