[__hostname/explorer/hostname] Darwin: Always fall back to hostname if scutil is missing or fails

This commit is contained in:
Dennis Camera 2019-09-30 12:52:43 +02:00
parent 2804a8bae6
commit abc765bd99

View file

@ -41,8 +41,8 @@ elif [ -f /etc/myname ]; then
elif [ "$(uname -s)" == FreeBSD ]; then
(. /etc/rc.conf && echo $hostname)
# Mac OS X
elif [ "$(uname -s)" == Darwin -a -x "$(command -v scutil)" ]; then
scutil --get HostName 2>/dev/null || hostname -s
elif [ "$(uname -s)" == Darwin ]; then
[ -x "$(command -v scutil)" ] && scutil --get HostName 2>/dev/null || hostname -s
else
command -v hostname && hostname -s
fi