Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Conversation

anntnzrb
Copy link

@anntnzrb anntnzrb commented Oct 31, 2020

After a fresh install of Arch Linux, I attempted to run pfetch, the hostname on the title section was missing, because indeed the hostname command didn't ship by default on this version of Arch (can't recall if it was present on older versions).

The environment variables HOSTNAME, hostname were not presented, but HOST was, at least on zsh. Tried checking if it was declared on the dash shell as well, it was not.
This means the variable HOST should/may be included in the options to look for the variable as well...
hostname=${HOST:-${HOSTNAME:-${hostname:-$(hostname || cat "/etc/hostname")}}}

The generic way of obtaining the hostname should be by reading the single-line-content-file located at /etc/hostname, as the hostname command's man page suggest.
So, if hostname fails cat "/etc/hostname" is used instead.

@dylanaraps
Copy link
Owner

Thanks!

@dylanaraps dylanaraps closed this in 2f0a022 Nov 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants