Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I guess I'm looking for how to make a script to run whenever you press ENTER in bash, so that it can alert you by echoing a line about some event if an event has occurred.

share|improve this question
up vote 2 down vote accepted

You can use the special PROMPT_COMMAND variable, look it up in man bash.

$ PROMPT_COMMAND='echo hello'

Set it at the end of ~/.bashrc. I suggest you write a function and call that function in the PROMPT_COMMAND.

share|improve this answer

There have been tools to do this for ages, starting with the venerable 'biff'. Gnubiff looks like the most capable (it does IMAP and POP3) option in ubuntu:

share|improve this answer

Your Answer


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.