Make the prompt work when hostname command missing (Arch)

This commit is contained in:
Anthony Rose 2020-04-07 15:46:49 +01:00
parent d24f4d442a
commit d62494b2a2

View file

@ -32,7 +32,7 @@ export PYTHONWARNINGS="ignore::UserWarning"
PS1="$ " PS1="$ "
if /bin/test -z "${HOST}"; then if /bin/test -z "${HOST}"; then
HOST="$(hostname)" HOST="$(hostname 2>/dev/null || cat /etc/hostname)"
fi fi
if /bin/test $(id -u) -eq 0; then if /bin/test $(id -u) -eq 0; then
export PS1="${HOST%%.*}# " export PS1="${HOST%%.*}# "
@ -269,6 +269,6 @@ if test -S "$SSH_AUTH_SOCK" && test -r "$HOME/.ssh/id_rsa" && [ $(ssh-add -l |
ssh-add "$HOME/.ssh/id_rsa" ssh-add "$HOME/.ssh/id_rsa"
fi fi
if [ -r $HOME/.shrc.$(hostname -s) ]; then if [ -r $HOME/.shrc.$(hostname -s 2>/dev/null || cat /etc/hostname) ]; then
. $HOME/.shrc.$(hostname -s) . $HOME/.shrc.$(hostname -s 2>/dev/null || cat /etc/hostname)
fi fi