Skip to content

Instantly share code, notes, and snippets.

@santiagon610
Last active December 16, 2022 23:11
Show Gist options
  • Select an option

  • Save santiagon610/9de14abf10fe3c0d2b3643c10834c061 to your computer and use it in GitHub Desktop.

Select an option

Save santiagon610/9de14abf10fe3c0d2b3643c10834c061 to your computer and use it in GitHub Desktop.
Colorful bash prompt - red when root
#!/bin/bash
# conditional bash prompt
# if root provide a red and white shell prompt
# if not root provide an orange and green shell prompt
#
# generated from ezprompt.net, nothing special :)
if [ $UID == 0 ]; then
PS1="\[\e[31m\]\u\[\e[m\]@\h \[\e[31m\]\w\[\e[m\] \\$ "
else
PS1="\[\e[33m\]\u\[\e[m\]@\[\e[32m\]\h\[\e[m\] \[\e[36m\]\w\[\e[m\] \\$ "
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment