Created
May 16, 2015 20:04
-
-
Save mycargus/33122a05b20308eb4866 to your computer and use it in GitHub Desktop.
set red bash prompt if root From http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If id command returns zero, you’ve root access. | |
if [ $(id -u) -eq 0 ]; | |
then # you are root, set red colour prompt | |
PS1="\\[$(tput setaf 1)\\]\\u@\\h:\\w #\\[$(tput sgr0)\\]" | |
else # normal | |
PS1="[\\u@\\h:\\w] $" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment