tShorten the test for root and be more polite. - hosts-gen - A little framework to generate /etc/hosts from /etc/hosts.d.
(HTM) git clone git://r-36.net/hosts-gen
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 562b4af551efc7249cb68f6d4b8909daf2ce7ce6
(DIR) parent 2ad5398d523036f9512a0b8932216ba09a438d51
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Sat, 23 Nov 2019 18:36:22 +0100
Shorten the test for root and be more polite.
Diffstat:
bin/hosts-gen | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/bin/hosts-gen b/bin/hosts-gen
t@@ -6,7 +6,7 @@ hostsfile="/etc/hosts"
hostfiles="$(ls -1 "${etcdir}" | grep '^[0-9]*-.*')"
-! [ "$(id -u)" = "0" ] && printf "Run as root\\n" && exit 1
+[ $(id -u ) -ne 0 ] && printf "Please run as root.\n" && exit 1
[ -e "$hostsfile" ] && cp "$hostsfile" "$hostsfile.bkp"