Skip to content

Instantly share code, notes, and snippets.

@amnuts amnuts/.bashrc
Last active Mar 17, 2016

Embed
What would you like to do?
Bash prompt stuff
# 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
You can’t perform that action at this time.