Advertisement
corrosiontears

Mudança de cor do prompt para o usuário root

Dec 12th, 2016
517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.50 KB | None | 0 0
  1. ## Dica retirada do Dicas-L:
  2. # http://www.dicas-l.com.br/arquivo/mudanca_de_cor_do_prompt_para_o_usuario_root.php
  3.  
  4. function setprompt
  5.   {
  6.       local BLUE='\[$(tput setaf 4)\]'
  7.       local RED='\[$(tput setaf 1)\]'
  8.       local RESET='\[$(tput sgr0)\]'
  9.       # Se 'id -u' retornar 0, você tem
  10.       # privilégios de superusuário
  11.       if [ `id -u` = 0 ]
  12.           then
  13.               PS1="$RED[\u@\h:\W]$RESET "
  14.           else
  15.               PS1="$BLUE[\u@\h:\W]$RESET "
  16.       fi
  17.   }
  18.   setprompt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement