Skip to content

Instantly share code, notes, and snippets.

@mycargus
Created May 16, 2015 20:04
Show Gist options
  • Save mycargus/33122a05b20308eb4866 to your computer and use it in GitHub Desktop.
Save mycargus/33122a05b20308eb4866 to your computer and use it in GitHub Desktop.
# 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