From 3071119235c81696cf7b23abfa0e685539856a41 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 22 Jan 2012 22:44:27 +0100 Subject: prompt: do not display root username, only red # at end of prompt --- bashrc/common/prompt.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'bashrc/common') diff --git a/bashrc/common/prompt.sh b/bashrc/common/prompt.sh index cc57e38..71e0598 100644 --- a/bashrc/common/prompt.sh +++ b/bashrc/common/prompt.sh @@ -11,15 +11,10 @@ __make_prompt() { _hostname=$(hostname) # username + nodename - [[ $(id -nu) == "alex" ]] || user="\u" + [[ $(id -nu) == "alex" || $(id -u) -eq 0 ]] || user="\u" [[ "${_hostname}" == "laptop" ]] || host="@${_hostname}" [[ -z "$user" && -z "$host" ]] || host="${host} " - - if [[ $(id -u) -eq 0 ]]; then - PS1UH="$(pcolor lred)${user}${host}$(pcolor)" - else - PS1UH="$(pcolor lcyan)${user}${host}$(pcolor)" - fi + PS1UH="$(pcolor lcyan)${user}${host}$(pcolor)" # working directory PS1D="$(pcolor lpurple)$(pwd -P)$(pcolor)" @@ -38,7 +33,11 @@ __make_prompt() { [[ -n "${VIRTUAL_ENV}" ]] && PS1VE="$(pcolor lred)<${VIRTUAL_ENV#${WORKON_HOME}/}>$(pcolor) " # prompt character - PS1P="$(pcolor lblue)\\\$ $(pcolor)" + if [[ $(id -u) -eq 0 ]]; then + PS1P="$(pcolor lred)\\\$ $(pcolor)" + else + PS1P="$(pcolor lblue)\\\$ $(pcolor)" + fi # open/closing brackets PS1BO="$(pcolor lgray)[$(pcolor)" -- cgit v1.2.3