aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpfetch4
1 files changed, 4 insertions, 0 deletions
diff --git a/pfetch b/pfetch
index 4a3f413..4e22558 100755
--- a/pfetch
+++ b/pfetch
@@ -112,6 +112,10 @@ get_title() {
# shellcheck disable=SC2039
hostname=${HOSTNAME:-${hostname:-$(hostname)}}
+ # If the hostname is still not found, fallback to the contents of the
+ # /etc/hostname file.
+ [ "$hostname" ] || read -r hostname < /etc/hostname
+
log "[3${PF_COL3:-1}m${user}${c7}@[3${PF_COL3:-1}m${hostname}" " " >&6
}