shellrc: check if hostname exists before displaying it

Resolves: SteamOS doesn't have the command
This commit is contained in:
Aminda Suomalainen 2023-10-09 12:05:39 +03:00
parent 9bc7bb0f18
commit 1e3a81a0e1
Signed by: Mikaela
SSH Key Fingerprint: SHA256:y2OpGEbett3Fqn8XFrP0X4mWfCVKf4rWkxERzqPY81U
2 changed files with 6 additions and 2 deletions

View File

@ -131,7 +131,9 @@ fi
#shopt -s autocd
# Show the hostname, uptime and users logged in on shell start
if hash hostname 2>/dev/null; then
(hostname &)
fi
(uptime &)
(echo "")
if [[ $UNAME != Darwin ]]; then

View File

@ -87,7 +87,9 @@ zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# Show the hostname, uptime and users logged in on shell start
if hash hostname 2>/dev/null; then
(hostname&)
fi
(uptime&)
(echo "")