Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Created November 2, 2012 05:54
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 ormaaj/3998967 to your computer and use it in GitHub Desktop.
Save ormaaj/3998967 to your computer and use it in GitHub Desktop.
bashrc
# /etc/bash/bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
[[ $- == *i* ]] || return
shopt -s checkwinsize histappend extglob lastpipe globstar cmdhist lithist
# Change the window title of X terminals
case $TERM in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)
PROMPT_COMMAND='printf "\E]0;%s@%s:%s\a" "$USER" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
;;
screen*)
PROMPT_COMMAND='printf "\E_%s@%s:%s\E\\" "$USER" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
esac
if x=$(tput colors) y=$? let 'y || x >= 8' && type -P dircolors >/dev/null; then
if [[ -f ~/.dir_colors ]]; then
eval "$(dircolors -b ~/.dir_colors)"
elif [[ -f /etc/DIR_COLORS ]]; then
eval "$(dircolors -b /etc/DIR_COLORS)"
fi
if [[ ${EUID:-$(id -u)} == 0 ]] ; then
PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi
ls() { command ls --color=auto "$@"; }
grep() { command grep --color=auto "$@"; }
elif [[ ${EUID:-$(id -u)} == 0 ]]; then
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment