home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 3.4 Automatic File Cleanup Chapter 3
Logging Out
Next: 3.6 Stop Accidental Bourne Shell Logouts
 

3.5 Stop Accidental C Shell Logouts

Do 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: Use `logout' to logout or perhaps Use `exit' to leave csh .

In the Korn shell and bash , use set -o ignoreeof instead. If you use the Bourne shell, article 3.6 has a workaround for the problem.

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.

- ML


Previous: 3.4 Automatic File Cleanup UNIX Power Tools Next: 3.6 Stop Accidental Bourne Shell Logouts
3.4 Automatic File Cleanup Book Index 3.6 Stop Accidental Bourne Shell Logouts

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System










??????????????@Mail.ru