Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 2.16 Approved Shells: Using Unapproved Login Shell Chapter 3Next: 3.2 Running Commands at Bourne/Korn Shell Logout
 

3. Logging Out

Contents:
Running Commands When You Log Out
Running Commands at Bourne/Korn Shell Logout
Electronic Fortune Cookies
Automatic File Cleanup
Stop Accidental C Shell Logouts
Stop Accidental Bourne Shell Logouts
Detaching a Session with screen
What tty Am I On?

3.1 Running Commands When You Log Out

Is there something you want to do every time you log out: run a program that deletes temporary files, asks you a question, or prints a fortune to your screen? If you use the C shell, make a file named .logout (2.2) in your home directory and put the commands there. Before a login C shell exits, it'll read that file. But not all shells are login C shells; you might want these shells to read your logout-type file, too. Articles 2.7 and 2.8 have some suggestions.

Some ideas for your .logout are:

If you connect to this host over a network, with a slow modem or on a data switch - and you don't see all the .logout commands run before your connection closes - try putting the command sleep 2 (40.2) at the end of the file. That makes the shell wait two seconds before it exits, which gives output more time to get to your screen.

- JP


Previous: 2.16 Approved Shells: Using Unapproved Login Shell UNIX Power ToolsNext: 3.2 Running Commands at Bourne/Korn Shell Logout
2.16 Approved Shells: Using Unapproved Login Shell Book Index3.2 Running Commands at Bourne/Korn Shell Logout

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