pfetch: fallback to /etc/hostname. Closes #83

This commit is contained in:
Dylan Araps 2020-11-01 05:51:12 +02:00
parent 0faef36de9
commit 2f0a022b1f
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

4
pfetch
View File

@ -112,6 +112,10 @@ get_title() {
# shellcheck disable=SC2039 # shellcheck disable=SC2039
hostname=${HOSTNAME:-${hostname:-$(hostname)}} 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 log "[3${PF_COL3:-1}m${user}${c7}@[3${PF_COL3:-1}m${hostname}" " " >&6
} }