Skip to content

Instantly share code, notes, and snippets.

@alesya-h
Created January 17, 2011 21:45
Show Gist options
  • Save alesya-h/783540 to your computer and use it in GitHub Desktop.
Save alesya-h/783540 to your computer and use it in GitHub Desktop.
кусок .bashrc
NONE="\033[0m" # unsets color to term's fg color
# regular colors
K="\033[0;30m" # black
R="\033[0;31m" # red
G="\033[0;32m" # green
Y="\033[0;33m" # yellow
B="\033[0;34m" # blue
M="\033[0;35m" # magenta
C="\033[0;36m" # cyan
W="\033[0;37m" # white
# emphasized (bolded) colors
B_K="\033[1;30m"
B_R="\033[1;31m"
B_G="\033[1;32m"
B_Y="\033[1;33m"
B_B="\033[1;34m"
B_M="\033[1;35m"
B_C="\033[1;36m"
B_W="\033[1;37m"
# underlined colors
U_K="\033[4;30m"
U_R="\033[4;31m"
U_G="\033[4;32m"
U_Y="\033[4;33m"
U_B="\033[4;34m"
U_M="\033[4;35m"
U_C="\033[4;36m"
U_W="\033[4;37m"
# background colors
BG_K="\033[40m"
BG_R="\033[41m"
BG_G="\033[42m"
BG_Y="\033[43m"
BG_B="\033[44m"
BG_M="\033[45m"
BG_C="\033[46m"
BG_W="\033[47m"
UC=$B_W # user's color
[ $UID -eq "0" ] && UC=$B_R # root's color
export PS1="\[$U_W\][\t \d]\[$NONE\] .: \[$B_W\]\w\[$NONE\] :. (\[$B_R$UC\]\u\[$NONE\]@\h)\n\[$B_R$UC\]\\$:\[$NONE\] "
export PROMPT_COMMAND='RET=$?; if [[ $RET -eq 0 ]]; then echo -e "$G # => $RET $NONE"; else echo -e "$BG_R # => $RET $NONE"; fi;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment