Created
December 5, 2013 18:41
-
-
Save omame/7810888 to your computer and use it in GitHub Desktop.
My PS1.
Yellow when working on my pc.
Blue when working on a remote server.
Last $ is red when previous command failed, otherwise is green.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check if we're on a ssh connection | |
if [ ! -z "$SSH_TTY" ]; then | |
pscolor=94 # Yellow | |
else | |
pscolor=33 # Blue | |
fi | |
function exitstatus { | |
# Manage exit status within the coloured prompt | |
if [ $? -ne 0 ]; then | |
export PS1="\[\033[01;"$pscolor"m\]\u@\h \t \w\[\033[00m\]\e[31m$ \e[0m" | |
else | |
export PS1="\[\033[01;"$pscolor"m\]\u@\h \t \w\[\033[00m\]\e[32m$ \e[0m" | |
fi | |
} | |
PROMPT_COMMAND=exitstatus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment