Source'ing a .logout file

Joseph E Poplawski jep at fantasci.UUCP
Mon Oct 10 03:04:49 AEST 1988


In my .kshrc, I have the function "logout" which I then alias to exit in the
following form:

alias exit="logout;exit"

Here is the logout function itself.  In my ".kshlogout", I have all the commands
which I want executed every time I logout.

------------------------------------------------------------------------------
# The function "logout" will source out a ".kshlogout" for performing those
# various things you do before logging out daily/weekly.
logout () {
    if [ "$PPID" = 1 ]	        # if login shell
    then
        if [ -s ~/.kshlogout ]  # if file exist and is not zero length
        then
            . ~/.kshlogout      # "source" the logout file
        fi
	rm -f ~/$HISTFILE	# remove the history file se we start fresh
	tput clear
        exit
    else 
        echo "Use 'exit' or Control-D to terminate this shell"
    fi
}
------------------------------------------------------------------------------

Hope this helps...

-Jo

-------------------------------------------------------------------------------
|Joseph E Poplawski  (Jo)                     US Mail:  1621 Jackson Street   |
|                                                       Cinnaminson NJ 08077  |
|UUCP:..!rutgers!rochester!moscom!telesci!fantasci!jep                        |
|     ..!princeton!telesci!fantasci!jep         Phone:  +1 609 786-8099 home  |
|     ..!pyrnj!telesci!fantasci!jep                                           |
-------------------------------------------------------------------------------



More information about the Comp.unix.wizards mailing list