In your .profile file, add the line:
trap '. $HOME/.sh_logout; exit' 0
(Some systems may need
$LOGDIR instead of
Make a file in your home directory named .sh_logout. Put in the commands you want to be run when you log out. For example:
clear if [ -f $HOME/todo.tomorrow ] then echo "=========== STUFF TO DO TOMORROW: ============" cat $HOME/todo.tomorrow fi
The trap will read the .sh_logout file when the shell exits.