From d62494b2a268eb307194684148d6eb90b28bae9d Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Tue, 7 Apr 2020 15:46:49 +0100 Subject: [PATCH] Make the prompt work when hostname command missing (Arch) --- roles/home-cli/files/shrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/home-cli/files/shrc b/roles/home-cli/files/shrc index 1526adb..62c9b60 100644 --- a/roles/home-cli/files/shrc +++ b/roles/home-cli/files/shrc @@ -32,7 +32,7 @@ export PYTHONWARNINGS="ignore::UserWarning" PS1="$ " if /bin/test -z "${HOST}"; then - HOST="$(hostname)" + HOST="$(hostname 2>/dev/null || cat /etc/hostname)" fi if /bin/test $(id -u) -eq 0; then 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" fi -if [ -r $HOME/.shrc.$(hostname -s) ]; then - . $HOME/.shrc.$(hostname -s) +if [ -r $HOME/.shrc.$(hostname -s 2>/dev/null || cat /etc/hostname) ]; then + . $HOME/.shrc.$(hostname -s 2>/dev/null || cat /etc/hostname) fi