edps

bash_ps1-debian

Nov 21st, 2015
87
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fill="--- "
  2.  
  3. reset_style='\[\033[00m\]'
  4. if [ -z "$VIM" ];
  5. then status_style=$reset_style'\[\033[0;90m\]' # gray color; use 0;37m for lighter color
  6. else status_style=$reset_style'\[\033[0;90;107m\]'
  7. fi
  8. prompt_style=$reset_style
  9. command_style=$reset_style'\[\033[1;29m\]' # bold black
  10.  
  11. OLD_PS1="$PS1"
  12. PS1="$status_style"'$fill \t\n'"$prompt_style$OLD_PS1$command_style"
  13.  
  14. trap 'echo -ne "\e[0m"' DEBUG
  15.  
  16. function prompt_command {
  17.  
  18.     let fillsize=${COLUMNS}-9
  19.     fill=""
  20.     while [ "$fillsize" -gt "0" ]
  21.     do
  22.         fill="-${fill}" # fill with underscores to work on
  23.         let fillsize=${fillsize}-1
  24.     done
  25.  
  26.     case "$TERM" in
  27.     xterm*|rxvt*)
  28.         bname=`basename "${PWD/$HOME/~}"`
  29.         echo -ne "\033]0;${bname}: ${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"
  30.         ;;
  31.     *)
  32.         ;;
  33.     esac
  34.  
  35. }
  36. PROMPT_COMMAND=prompt_command
RAW Paste Data