bashrc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Begin /etc/bashrc
  2. # Written for Beyond Linux From Scratch
  3. # by James Robertson <jameswrobertson@earthlink.net>
  4. # updated by Bruce Dubbs <bdubbs@linuxfromscratch.org>
  5. # System wide aliases and functions.
  6. # System wide environment variables and startup programs should go into
  7. # /etc/profile. Personal environment variables and startup programs
  8. # should go into ~/.bash_profile. Personal aliases and functions should
  9. # go into ~/.bashrc
  10. # Provides a colored /bin/ls command. Used in conjunction with code in
  11. # /etc/profile.
  12. alias ls='ls --color=auto'
  13. # Provides prompt for non-login shells, specifically shells started
  14. # in the X environment. [Review the LFS archive thread titled
  15. # PS1 Environment Variable for a great case study behind this script
  16. # addendum.]
  17. NORMAL="\[\e[0m\]"
  18. RED="\[\e[1;31m\]"
  19. GREEN="\[\e[1;32m\]"
  20. WHITE="\[\e[1;37m\]"
  21. case $TERM in
  22. xterm|rxvt*)
  23. TITLEBAR='\[\033]0;\u@\h \007\]'
  24. ;;
  25. *)
  26. TITLEBAR=''
  27. ;;
  28. esac
  29. if [[ $EUID == 0 ]] ; then
  30. PS1="$TITLEBAR$RED\u [ $NORMAL\w$RED ]# $NORMAL"
  31. else
  32. PS1="$TITLEBAR$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
  33. fi
  34. # End /etc/bashrc