aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2020-11-01 05:51:12 +0200
committerDylan Araps <dylan.araps@gmail.com>2020-11-01 05:51:12 +0200
commit2f0a022b1f89ab0afae3bfa066ef8994796c29ac (patch)
tree2e7e144f18c400df2d0e52b6f19f07e32be17395
parent0faef36de92a0bafbdb9ea88da9f7aa9b8c6dd63 (diff)
downloadpfetch-2f0a022b1f89ab0afae3bfa066ef8994796c29ac.tar.gz
pfetch: fallback to /etc/hostname. Closes #83
-rwxr-xr-xpfetch4
1 files changed, 4 insertions, 0 deletions
diff --git a/pfetch b/pfetch
index aca4278..b5e0c72 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
}