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.
This commit is contained in:
joris 2012-07-20 12:54:12 +02:00
parent 5ac2cd94e0
commit 754839ae76

2
liquidprompt.bash Normal file → Executable file
View File

@ -122,7 +122,7 @@ __user()
# if user is not root # if user is not root
if [ "$EUID" -ne "0" ] ; then if [ "$EUID" -ne "0" ] ; then
# if user is not login user # if user is not login user
if [[ ${USER} != $(logname) ]]; then if [[ ${USER} != "$(logname 2>/dev/null)" ]]; then
user="${LIGHT_GREY}\u${NO_COL}" user="${LIGHT_GREY}\u${NO_COL}"
else else
user="\u" user="\u"