diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2012-01-22 22:44:27 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2012-01-22 22:47:52 +0100 |
commit | 3071119235c81696cf7b23abfa0e685539856a41 (patch) | |
tree | e3717b2ebdf7013231015caa30f59d405690cfe0 /bashrc/common | |
parent | 21e0a0efd1f7e56c1611c80258049491f2a1d96d (diff) | |
download | dotfiles-3071119235c81696cf7b23abfa0e685539856a41.tar.gz dotfiles-3071119235c81696cf7b23abfa0e685539856a41.tar.xz dotfiles-3071119235c81696cf7b23abfa0e685539856a41.zip |
prompt: do not display root username, only red # at end of prompt
Diffstat (limited to 'bashrc/common')
-rw-r--r-- | bashrc/common/prompt.sh | 15 |
1 files changed, 7 insertions, 8 deletions
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)" |