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:
parent
5ac2cd94e0
commit
754839ae76
2
liquidprompt.bash
Normal file → Executable file
2
liquidprompt.bash
Normal file → Executable 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"
|
||||||
|
Loading…
Reference in New Issue
Block a user