Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I tell terminal to call the "exit" command automatically when I exit the terminal?

I am running Ubuntu Unity and using the default terminal program. I want to call "exit" before exiting terminal because, if I do not, then a certain process does not quit.

share|improve this question
2  
Which certain process? How do you exit, by clicking the x or with Ctrl+D? –  Baarn Sep 8 '12 at 21:30
add comment

1 Answer

up vote 0 down vote accepted

I assume you mean you want the shell running in the terminal to call a function before exit. In that case use trap, try this:

trap 'echo Hey' INT

Now send an interrupt signal to yourself:

kill -INT $$

Instead of echo Hey you can call an arbitrary function.

share|improve this answer
add comment

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.