diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2019-09-24 11:13:40 +0300 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2019-09-24 11:13:40 +0300 |
| commit | 31590401f2345a2b5b75fac1c5869dbd5fb5922f (patch) | |
| tree | ea87193cd1bbbd87c79c1083f7ef7947c18aaa7c | |
| parent | 70fb22fa5da61703ea93bbe2de817abb712a198c (diff) | |
| download | pfetch-31590401f2345a2b5b75fac1c5869dbd5fb5922f.tar.gz | |
pfetch: add support for user@host
| -rwxr-xr-x | pfetch | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -23,6 +23,27 @@ get_os() { esac } +get_title() { + case $os in + linux) + read -r hostname < /proc/sys/kernel/hostname + ;; + esac + + # Username is retrieved by first checking '$USER' with a fallback + # to the 'whoami' command. + # + # Hostname is retrieved by first checking '$HOSTNAME' with a fallback + # to the OS specific detection above and finally an additional fallback + # to the 'hostname' command. + # + # Disable the warning about '$HOSTNAME' being undefined + # in POSIX sh as it is intended for allowing the user to + # overwrite the value on invocation. + # shellcheck disable=SC2039 + log 1 "${USER:-$(whoami)}" @ "${HOSTNAME:-${hostname:-$(hostname)}}" +} + get_distro() { case $os in linux) @@ -107,6 +128,7 @@ main() { EOF get_os + get_title get_distro get_kernel get_uptime |
