From 5b247e3d82906fd738980b07b65005087e208217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Schmidts?= Date: Fri, 25 Jan 2013 12:20:19 +0100 Subject: [PATCH] it doesn't seem that LP_USER need to be defined at each prompt set --- liquidprompt | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/liquidprompt b/liquidprompt index 57bc4db..319a0e6 100755 --- a/liquidprompt +++ b/liquidprompt @@ -307,27 +307,20 @@ unset _lp_source_config ############### # Yellow for root, bold if the user is not the login one, else no color. -_lp_user() -{ - local user - # if user is not root - if [[ "$EUID" -ne "0" ]] ; then - # if user is not login user - if [[ ${USER} != "$(logname 2>/dev/null)" ]]; then - user="${LP_COLOR_USER_ALT}${_LP_USER_SYMBOL}${NO_COL}" - else - if [[ "${LP_USER_ALWAYS}" -ne "0" ]] ; then - user="${LP_COLOR_USER_LOGGED}${_LP_USER_SYMBOL}${NO_COL}" - else - user="" - fi - fi +if [[ "$EUID" -ne "0" ]] ; then # if user is not root + # if user is not login user + if [[ ${USER} != "$(logname 2>/dev/null)" ]]; then + LP_USER="${LP_COLOR_USER_ALT}${_LP_USER_SYMBOL}${NO_COL}" else - user="${LP_COLOR_USER_ROOT}${_LP_USER_SYMBOL}${NO_COL}" + if [[ "${LP_USER_ALWAYS}" -ne "0" ]] ; then + LP_USER="${LP_COLOR_USER_LOGGED}${_LP_USER_SYMBOL}${NO_COL}" + else + LP_USER="" + fi fi - - echo -ne $user -} +else + LP_USER="${LP_COLOR_USER_ROOT}${_LP_USER_SYMBOL}${NO_COL}" +fi ################# @@ -1219,7 +1212,6 @@ _lp_set_prompt() LP_TIME=$(_lp_sr "$(_lp_time)") # in main prompt: no space - LP_USER=$(_lp_user) LP_PROXY="$(_lp_proxy)" # right of main prompt: space at left