From ohcanada, 1 Week ago, written in Bash.
  1. # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
  2. # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
  3.  
  4. if [ "${PS1-}" ]; then
  5.   if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
  6.     # The file bash.bashrc already sets the default PS1.
  7.     # PS1='\h:\w\$ '
  8.     if [ -f /etc/bash.bashrc ]; then
  9.       . /etc/bash.bashrc
  10.     fi
  11.   else
  12.     if [ "`id -u`" -eq 0 ]; then
  13.       PS1='# '
  14.     else
  15.       PS1='$ '
  16.     fi
  17.   fi
  18. fi
  19.  
  20. if [ -d /etc/profile.d ]; then
  21.   for i in /etc/profile.d/*.sh; do
  22.     if [ -r $i ]; then
  23.       . $i
  24.     fi
  25.   done
  26.   unset i
  27. fi
  28.  
  29. export GIT_PS1_SHOWCOLORHINTS=1
  30. export GIT_PS1_SHOWDIRTYSTATE=1
  31. export GIT_PS1_SHOWSTASHSTATE=1
  32. export GIT_PS1_SHOWUNTRACKEDFILES=1
  33. #export GIT_PS1_SHOWUPSTREAM="auto"
  34.  
  35. NORMAL="\[\e[m\]"
  36.  
  37. RED="\[\e[31m\]"
  38. GREEN="\[\e[32m\]"
  39. YELLOW="\[\e[33m\]"
  40. BLUE="\[\e[34m\]"
  41. MAGENTA="\[\e[35m\]"
  42. CYAN="\[\e[36m\]"
  43. WHITE="\[\e[37m\]"
  44.  
  45. LIGHTRED="\[\e[31;01m\]"
  46. LIGHTGREEN="\[\e[32;01m\]"
  47. LIGHTYELLOW="\[\e[33;01m\]"
  48. LIGHTBLUE="\[\e[34;01m\]"
  49. LIGHTMAGENTA="\[\e[35;01m\]"
  50. LIGHTCYAN="\[\e[36;01m\]"
  51. LIGHTWHITE="\[\e[37;01m\]"
  52.  
  53. # set prompt to show status of git repo, and also set terminal window name
  54. if [ $UID = 0 ]; then
  55.         # User "root" ... red prompt strings ...
  56.   PROMPT_COMMAND=' xn $USER@$HOSTNAME ; __git_ps1 "\n$YELLOW[$NORMAL\A $RED\u$NORMAL@$GREEN\h $LIGHTBLUE\l$NORMAL $RED\w$NORMAL" "$YELLOW]$NORMAL\n# "'
  57. else
  58.         # Loozer ... cyan prompt strings ...
  59.   PROMPT_COMMAND=' xn $USER@$HOSTNAME ; __git_ps1 "\n$YELLOW[$NORMAL\A $RED\u$NORMAL@$GREEN\h $LIGHTBLUE\l$NORMAL $CYAN\w$NORMAL" "$YELLOW]$NORMAL\n\$ "'
  60. fi
  61.  
  62. export PROMPT_COMMAND
captcha