From 754839ae769c55439398843adc68b4055299bc40 Mon Sep 17 00:00:00 2001 From: joris Date: Fri, 20 Jul 2012 12:54:12 +0200 Subject: [PATCH] In some linux distro logname somtimes returns with error. Eg: $ LANG=C logname ; echo $? logname: no login name 1 Fix this by redirecting stderr to /dev/null. Also protect the var for test(1) if it's empty. --- liquidprompt.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 liquidprompt.bash diff --git a/liquidprompt.bash b/liquidprompt.bash old mode 100644 new mode 100755 index e4609db..febfe5b --- a/liquidprompt.bash +++ b/liquidprompt.bash @@ -122,7 +122,7 @@ __user() # if user is not root if [ "$EUID" -ne "0" ] ; then # if user is not login user - if [[ ${USER} != $(logname) ]]; then + if [[ ${USER} != "$(logname 2>/dev/null)" ]]; then user="${LIGHT_GREY}\u${NO_COL}" else user="\u"