Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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
share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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