From 197d01359b386165ac61aa26c25f8ccc12410152 Mon Sep 17 00:00:00 2001 From: wx913462 Date: Mon, 25 Apr 2022 09:29:41 +0800 Subject: [PATCH] Adjust commands sequence Prefer hostname and uname commands to avoid time consuming in hostnamectl. --- profile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profile b/profile index 542add4..5a3ec3c 100644 --- a/profile +++ b/profile @@ -42,9 +42,9 @@ else pathmunge /usr/sbin after fi -HOSTNAME=$(/usr/bin/hostnamectl --transient 2>/dev/null) || \ HOSTNAME=$(/usr/bin/hostname 2>/dev/null) || \ -HOSTNAME=$(/usr/bin/uname -n) +HOSTNAME=$(/usr/bin/uname -n 2>/dev/null) || \ +HOSTNAME=$(/usr/bin/hostnamectl --transient 2>/dev/null) || echo "System commands: hostname uname and hostnamectl, which do not exist." if [ -z "$HISTSIZE" ] ; then HISTSIZE=1000 -- 2.27.0