3.5 Stop Accidental C Shell LogoutsDo you occasionally type CTRL-d by mistake and find out that you're suddenly logged off the system? If you do, you should know about the ignoreeof shell variable or option. CTRL-d is the end-of-file character; when a shell sees it, it thinks that no more input is coming, so it quits. If you're in your login shell (51.9 ) , you're suddenly logged out. If you're not in your login shell, you may still be in trouble: a window may have disappeared, or your environment may have suddenly changed because you dropped from a subshell (38.4 ) into the parent shell. If you're a C shell user, you can solve this problem by setting the ignoreeof shell variable: set ignoreeof # prevent accidental shell termination (Most users set this in their .cshrc
or .login
files.)
Now typing
CTRL-d
won't terminate the shell. Instead, you'll get a
polite message:
In the Korn shell and bash
,
use If you're like me, you won't use this feature; I happen to find CTRL-d a convenient shorthand for the logout or exit commands. But my taste is certainly disputable, and even I will admit that my fingers sometimes err. - |
|