I am using OS X and I want to know if there are any unread messages in my Mail.app? I want to put that number in my shell prompt.
How do I go about it?
First, set your prompt to perform substitutions as explained here: Get Function Into PS1 (Zsh)?
Note that Mail.app needs to be running for all of this to work. In your
Finally, redefine your prompt based on the new function. The following would be the most basic approach – but feel free to add your own variables as needed:
If you don't want to mess with your prompt or use one of the oh-my-zsh styles, or even the
Whichever method you use, your unread mail count will be output in plain text. If you want to change the messages, take a look at the source of the
I found this most efficient.