Shell include that shows the status of the last-executed process
To use:
-
Save
pretty-exit-status.shsomewhere sensible. (e.g.,~/.pretty_exit_status.sh) -
In your
.bashrcor.bash_profileadd the following:
source ~/.pretty_exit_status.sh
(or wherever you saved the script)
- Later on in that same
.bashrcor.bash_profile, put the following somewhere in thePS1variable:
$(pretty_exit_status $?)
For example, if you just want to prefix your current prompt, just do:
export PS1='$(pretty_exit_status $?)\n'$PS1
That’s it! :)