Skip to content

Instantly share code, notes, and snippets.

@jaysoffian
Created February 1, 2017 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaysoffian/8c75e661f7a61b0d094703e265d8d5b4 to your computer and use it in GitHub Desktop.
Save jaysoffian/8c75e661f7a61b0d094703e265d8d5b4 to your computer and use it in GitHub Desktop.
.bashrc for staging/production machines
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
set_prompt() {
local titlebar red yellow reset
case $TERM in
xterm|xterm-256color)
titlebar='\[\e]0;\h:\w\007\]'
red=$(tput setaf 1)
yellow=$(tput setaf 3)
reset=$(tput sgr0)
reset="\\[$reset\\]"
;;
esac
local color
case $HOSTNAME in
*.stage.*) color=$yellow ;;
*) color=$red ;;
esac
color="\\[$color\\]"
local prompt='\H:\W$'
PS1="${titlebar}${color}${prompt}${reset} "
}
set_prompt
@sckn
Copy link

sckn commented Feb 1, 2017

Hi,
it's look good.

In my opinion, root and normal user should be coloured differently, if you're use su.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment