I want cowsay to print something like "have a nice day" when I close the terminal. I know I have to have some kind of script, but I'm not even sure how to write a script or how to use it once it's written. Any advice?


1 Answer 1


You could try adding the line:

trap 'cowsay "Have a nice day!"; sleep 1' EXIT

to your .bashrc file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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