Created
February 1, 2017 20:17
-
-
Save jaysoffian/8c75e661f7a61b0d094703e265d8d5b4 to your computer and use it in GitHub Desktop.
.bashrc for staging/production machines
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
# .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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
it's look good.
In my opinion, root and normal user should be coloured differently, if you're use su.