Advertisement
BoogeyCZ

Untitled

Feb 17th, 2019
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.82 KB | None | 0 0
  1.         PROMPT_COMMAND=__prompt_command
  2.  
  3.         __prompt_command() {
  4.             local EXIT="$?"
  5.             PS1=""
  6.  
  7.             local Reset='\[$(tput sgr0)\]'
  8.             local Gray='\[\033[38;5;7m\]'
  9.             local Green='\[\033[38;5;2m\]'
  10.             local Yellow='\[\033[38;5;3m\]'
  11.             local Blue='\[\033[38;5;12m\]'
  12.             local Cyan='\[\033[38;5;14m\]'
  13.             local Red='\[\033[38;5;9m\]'
  14.  
  15.             local ExitColor="${Green}"
  16.             local UserColor="${Green}"
  17.  
  18.             if [ $USER == "root" ]
  19.             then
  20.               UserColor="${Red}"
  21.             fi
  22.  
  23.             if [ $EXIT != 0 ]
  24.             then
  25.               ExitColor="${Red}"
  26.             fi
  27.  
  28.             PS1="${Reset}[${UserColor}\u${Yellow}@${Blue}\h ${Cyan}\w${Reset}]${ExitColor}"'\$'"${Reset} "
  29.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement