parrot-prompt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # ~/.bashrc: executed by bash(1) for non-login shells.
  2. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
  3. # for examples
  4. # If not running interactively, don't do anything
  5. case $- in
  6. *i*) ;;
  7. *) return;;
  8. esac
  9. export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/share/games:/usr/local/sbin:/usr/sbin:/sbin:~/.local/bin:/snap/bin:$PATH
  10. # don't put duplicate lines or lines starting with space in the history.
  11. # See bash(1) for more options
  12. HISTCONTROL=ignoreboth
  13. # append to the history file, don't overwrite it
  14. shopt -s histappend
  15. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  16. HISTSIZE=1000
  17. HISTFILESIZE=2000
  18. # check the window size after each command and, if necessary,
  19. # update the values of LINES and COLUMNS.
  20. shopt -s checkwinsize
  21. # If set, the pattern "**" used in a pathname expansion context will
  22. # match all files and zero or more directories and subdirectories.
  23. #shopt -s globstar
  24. # make less more friendly for non-text input files, see lesspipe(1)
  25. #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  26. # set variable identifying the chroot you work in (used in the prompt below)
  27. if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
  28. debian_chroot=$(cat /etc/debian_chroot)
  29. fi
  30. # set a fancy prompt (non-color, unless we know we "want" color)
  31. case "$TERM" in
  32. xterm-color) color_prompt=yes;;
  33. esac
  34. # uncomment for a colored prompt, if the terminal has the capability; turned
  35. # off by default to not distract the user: the focus in a terminal window
  36. # should be on the output of commands, not on the prompt
  37. force_color_prompt=yes
  38. if [ -n "$force_color_prompt" ]; then
  39. if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  40. # We have color support; assume it's compliant with Ecma-48
  41. # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  42. # a case would tend to support setf rather than setaf.)
  43. color_prompt=yes
  44. else
  45. color_prompt=
  46. fi
  47. fi
  48. if [ "$color_prompt" = yes ]; then
  49. PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"
  50. else
  51. PS1='┌──[\u@\h]─[\w]\n└──╼ \$ '
  52. fi
  53. # Set 'man' colors
  54. if [ "$color_prompt" = yes ]; then
  55. man() {
  56. env \
  57. LESS_TERMCAP_mb=$'\e[01;31m' \
  58. LESS_TERMCAP_md=$'\e[01;31m' \
  59. LESS_TERMCAP_me=$'\e[0m' \
  60. LESS_TERMCAP_se=$'\e[0m' \
  61. LESS_TERMCAP_so=$'\e[01;44;33m' \
  62. LESS_TERMCAP_ue=$'\e[0m' \
  63. LESS_TERMCAP_us=$'\e[01;32m' \
  64. man "$@"
  65. }
  66. fi
  67. unset color_prompt force_color_prompt
  68. # If this is an xterm set the title to user@host:dir
  69. case "$TERM" in
  70. xterm*|rxvt*)
  71. PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\$\[\e[0m\]"
  72. ;;
  73. *)
  74. ;;
  75. esac
  76. # enable color support of ls and also add handy aliases
  77. if [ -x /usr/bin/dircolors ]; then
  78. test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  79. alias ls='ls --color=auto'
  80. alias dir='dir --color=auto'
  81. alias vdir='vdir --color=auto'
  82. alias grep='grep --color=auto'
  83. alias fgrep='fgrep --color=auto'
  84. alias egrep='egrep --color=auto'
  85. fi
  86. # some more ls aliases
  87. alias ll='ls -lh'
  88. alias la='ls -lha'
  89. alias l='ls -CF'
  90. alias em='emacs -nw'
  91. alias dd='dd status=progress'
  92. alias _='sudo'
  93. alias _i='sudo -i'
  94. # Alias definitions.
  95. # You may want to put all your additions into a separate file like
  96. # ~/.bash_aliases, instead of adding them here directly.
  97. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
  98. if [ -f ~/.bash_aliases ]; then
  99. . ~/.bash_aliases
  100. fi
  101. # enable programmable completion features (you don't need to enable
  102. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  103. # sources /etc/bash.bashrc).
  104. if ! shopt -oq posix; then
  105. if [ -f /usr/share/bash-completion/bash_completion ]; then
  106. . /usr/share/bash-completion/bash_completion
  107. elif [ -f /etc/bash_completion ]; then
  108. . /etc/bash_completion
  109. fi
  110. fi
  111. # QNET: Custom Prompting
  112. MSG="/tmp/prompt_msg"
  113. prompt_func() {
  114. if [[ -f "$MSG" ]]; then # exists
  115. if [[ -n "$MSG" ]]; then # not empty
  116. cat "$MSG"
  117. echo ''
  118. fi
  119. fi
  120. }
  121. PROMPT_COMMAND='prompt_func'