ZSH prompt: exit status of last command
Perhaps you are as curious as me and want to know the exit status of the last command you ran in your ZSH-powered Terminal?
Then use the following code and put it into your ~/.zshrc file
autoload -U colors && colors
local returncode="%(?..%{$fg[red]%} %? ↵%{$resetcolor%})"
export RPS1='$(gitinfo)${returncode}'
This will show you the exit code of the last command, if it did not exit successfully (by UNIX convention: if the exit code is bigger than 0).
Special features included: it's colored and shown on the right side!
Written by Florian Störkle
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#