In an attempt to execute a script when a user logs out from a shell session, I added

trap SCRIPT 0 1 2 15;

in .profile..

Why is it not working?

link|improve this question
feedback

1 Answer

The different shells run different files on logout - you can execute your script from one of these files, depending on you shell:

  • for bash the file is ~/.bash_logout
  • for tcsh the file is ~/.logout
  • for zsh the file is ~/.zlogout
link|improve this answer
I'm doing this exercise i.imgur.com/Jg6VW.png and i have to use .profile and trap – Furqan Oct 5 '11 at 18:13
its from The Unix programming Environment By Robert Pike and Brain W. Kernighan – Furqan Oct 5 '11 at 18:14
2  
@Furqan So what? We are not here to answer exercises. Vladimir's answer is correct and works. – mailq Oct 5 '11 at 19:30
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.