Skip to content

Instantly share code, notes, and snippets.

Jonathan Hartley tartley

Block or report user

Report or block tartley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tartley
tartley / exitval in ps1
Created Jul 10, 2012
prepend a red 'last command exit value' to PS1, only for non-zero values.
View exitval in ps1
# display red exit value if it isn't zero
PROMPT_COMMAND='EXITVAL=$?; '$PROMPT_COMMAND
GET_EXITVAL='$(if [[ $EXITVAL != 0 ]]; then echo -n "\[\e[37;41;01m\] $EXITVAL \[\e[0m\] "; fi)'
export PS1="$GET_EXITVAL$PS1"
You can’t perform that action at this time.