fork download
  1. # Test for an interactive shell. There is no need to set anything
  2. # past this point for scp and rcp, and it's important to refrain from
  3. # outputting anything in those cases.
  4. if [[ $- != *i* ]] ; then
  5. # Shell is non-interactive. Be done now!
  6. return
  7. fi
  8.  
  9. # Bash won't get SIGWINCH if another process is in the foreground.
  10. # Enable checkwinsize so that bash will check the terminal size when
  11. # it regains control. #65623
  12. # http://c...content-available-to-author-only...u.edu/~chet/bash/FAQ (E11)
  13. shopt -s checkwinsize
  14.  
  15. # Enable history appending instead of overwriting. #139609
  16. shopt -s histappend
  17.  
  18. # Change the window title of X terminals
  19. case ${TERM} in
  20. xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)
  21. PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\
  22. ;;
  23. screen)
  24. PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\03
  25. ;;
  26. esac
  27.  
  28. use_color=false
  29.  
  30. # Set colorful PS1 only on colorful terminals.
  31. # dircolors --print-database uses its own built-in database
  32. # instead of using /etc/DIR_COLORS. Try to use the external file
  33. # first to take advantage of user additions. Use internal bash
  34. # globbing instead of external grep binary.
  35. safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
  36. match_lhs=""
  37. [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
  38. [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
  39. [[ -z ${match_lhs} ]] \
  40. && type -P dircolors >/dev/null \
  41. && match_lhs=$(dircolors --print-database)
  42. [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
  43.  
  44. if ${use_color} ; then
  45. # Enable colors for ls, etc. Prefer ~/.dir_colors #64489
  46. if type -P dircolors >/dev/null ; then
  47. if [[ -f ~/.dir_colors ]] ; then
  48. eval $(dircolors -b ~/.dir_colors)
  49. elif [[ -f /etc/DIR_COLORS ]] ; then
  50. eval $(dircolors -b /etc/DIR_COLORS)
  51. fi
  52. fi
  53.  
  54. if [[ ${EUID} == 0 ]] ; then
  55. PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
  56. else
  57. PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
  58. fi
  59.  
  60. alias ls='ls --color=auto'
  61. alias grep='grep --colour=auto'
  62. else
  63. if [[ ${EUID} == 0 ]] ; then
  64. # show root@ when we don't have colors
  65. PS1='\u@\h \W \$ '
  66. else
  67. PS1='\u@\h \w \$ '
  68. fi
  69. fi
Runtime error #stdin #stdout 0.02s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty