This page was generated from 03.logout.mth.

This page is part of the course work for CS360: Systems Tools course offered by the Computer Science Department at CalState, San Bernardino, California, USA. It was generated by Dr. Dick Botting.


    Making Yourself at home: Logging Out

    In UNIX you can make a shell do something every time you log out. This is a neat trick, but not essential for the power user. (IMHO) I won't examine you on it.


    (why): 3.01,
    (useful): 3.02, 3.03, 3.08
    (perhaps): 3.04, 3.05, 3.06
    (skip): 3.07


    In some shells you put the commands in a file called
    in others you run a command that "traps" the actual termination of the shell launched when you logged in. You set the trap inside a .login or .profile.

    3.04: Cleaning up temporary files is a neat thing to do when you logout.

    3.05, 3.06: Logging out by accident is irritating enough that you won't do it more than 3 or 4 times. (IMHO)

    (cookies): I wrote a personal fortune cookie generator. Personally I like to have a cookie when I log in rather than when I leave... Try 'cookie' on 'blaze' or 'orion'. Or drop in the WWW page [ cookie.html ] which cooks a fresh cookie every minute. You can find the code -- shell scripts of course -- I only use the finest ingredients in my cookies! See [ cookie ] This is a script you can borrow and modify to use with your own cookie file.


  1. trap::command, sets an action to be carried out on receipt of one of a 15 or more different signals.

  2. fortune::program, prints out a pseudo fortune cookie.

  3. setting_an_end_of_shell_trap::="trap " "'" command "'" 0.
  4. asking_for_a_fortune_cookie::="/usr/games/fortune " options.


    Look for machines with fortune and cookie on them. Try
        /usr/games/fortune -l
    on these.

    See also

    Sections 3.01..04, 3.08


    You have time to play lots of games while working on UNIX so which of the following would you put in your .profile:
      PATH =$PATH:/usr/games
      PATH= $PATH:/usr/games

    Submit Your Notes Here

    To earn credit for completing this part of the course you need to send me a short list of things you have learned. A simple way to do this is to follow this [click here [socket symbol] if you can fill this hole] link and fill in the form.