Last active
March 17, 2016 16:17
-
-
Save amnuts/0d2fe164d360293d999f to your computer and use it in GitHub Desktop.
Bash prompt stuff
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
# change the colour of the base directory depending on whether | |
# I'm in the live/staging/dev areas. Also show the user and host | |
# as well as the bash history number of the command. | |
C_DEV="\[\033[0;32m\]" # green | |
C_STAGE="\[\033[0;33m\]" # yellow | |
C_LIVE="\[\033[1;31m\]" # bold red | |
C_PATH="\[\033[0;37m\]" # white | |
C_COUNT="\[\033[0;36m\]" # cyan | |
C_NONE="\[\033[0m\]" # reset | |
function be_my_prompt { | |
ROOTDIR=`pwd | awk -F/ '{print $(2)}'` | |
if [ $ROOTDIR == "cwisnew" ] ; then | |
C_ROOTDIR="$C_LIVE$ROOTDIR" | |
elif [ $ROOTDIR == "cwisnewdev" ] ; then | |
C_ROOTDIR="$C_DEV$ROOTDIR" | |
elif [ $ROOTDIR == "cwisstage" ] ; then | |
C_ROOTDIR="$C_STAGE$ROOTDIR" | |
else | |
C_ROOTDIR="$ROOTDIR" | |
fi | |
PS1="[\u@\h:$C_ROOTDIR$C_NONE #$C_COUNT\!$C_NONE] $C_PATH\W$C_NONE $ " | |
} | |
PROMPT_COMMAND=be_my_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment