changeset 530:0ab0820fd528

Red-colored prompt for root?
author edogawaconan <me@myconan.net>
date Fri, 17 Oct 2014 10:23:36 +0900
parents de3ff51840a3
children d6e08a057094
files rc/bashrc
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rc/bashrc	Thu Oct 16 21:47:36 2014 +0900
+++ b/rc/bashrc	Fri Oct 17 10:23:36 2014 +0900
@@ -230,8 +230,10 @@
 case "${TERM}" in
   xterm*|screen*|dtterm*)
     PROMPT_COMMAND='echo -ne "\033]0;'"${USER:-$LOGNAME}@$(uname -n)"': ${PWD}\007";'"${PROMPT_COMMAND}"
-    # DragonFly's Bash is a bit buggy.
-    if [ "$(uname)" != "DragonFly" ]; then
+    if [ "$(id -u)" = "0" ]; then
+      PS1='\[\e[1;31m\]\u@\h:\w\$\[\e[0m\] '
+    elif [ "$(uname)" != "DragonFly" ]; then
+      # DragonFly's Bash is a bit buggy.
       PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;36m\]\w\[\e[0m\]\$ '
     fi
   ;;