From 43356307c8bfccff6e4835342f782c5a87664d79 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 13 Feb 2018 20:59:53 +0100 Subject: Only change hostname if $myhost is a non-emptry string (after white-space stripping). --- install-itzks-workstation | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'install-itzks-workstation') diff --git a/install-itzks-workstation b/install-itzks-workstation index fa5f57b..95b1ac8 100755 --- a/install-itzks-workstation +++ b/install-itzks-workstation @@ -224,11 +224,13 @@ es mw101.intern heißen. [ENTER]' echo # Set hostname -read -p 'Wie lautet der Hostname (ohne Domain)? ' myhost +read -p 'Wie lautet der Hostname (ohne Domain, leer lassen, wenn Hostname des System nicht geändert werden muss)? ' myhost echo -hostnamectl set-hostname "$myhost" -export HOSTNAME="$myhost" +if [ -n "$(echo $myhost | xargs | cut -d" " -f1)" ]; then + hostnamectl set-hostname "$myhost" + export HOSTNAME="$myhost" +fi unset myhost # To be sure restart the following services -- cgit v1.2.3