From 7a01e0fae39a6841c6a0d49b7e14a83fcdf723cd Mon Sep 17 00:00:00 2001 From: Joakim Roubert Date: Fri, 23 Aug 2019 10:29:36 +0200 Subject: [PATCH] install.sh: Use -eq instead of = for integer comparison For integer comparison, it is recommended to use '-eq' instead of the broader comparison '='. From the manual: n1 -eq n2 True if the integers n1 and n2 are algebraically equal. s1 = s2 True if the strings s1 and s2 are identical. Change-Id: I3a92c3944a19e7a618438a9e3e304d9de5d9874f Signed-off-by: Joakim Roubert --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index afd9e16e60..0fc2da812b 100755 --- a/install.sh +++ b/install.sh @@ -167,7 +167,7 @@ setup_env() { # --- use sudo if we are not already root --- SUDO=sudo - if [ `id -u` = 0 ]; then + if [ `id -u` -eq 0 ]; then SUDO= fi @@ -397,7 +397,7 @@ create_killall() { $SUDO tee ${BIN_DIR}/${KILLALL_K3S_SH} >/dev/null << \EOF #!/bin/sh set -x -[ `id -u` = 0 ] || exec sudo $0 $@ +[ `id -u` -eq 0 ] || exec sudo $0 $@ for bin in /var/lib/rancher/k3s/data/**/bin/; do [ -d $bin ] && export PATH=$bin:$PATH @@ -453,7 +453,7 @@ create_uninstall() { $SUDO tee ${BIN_DIR}/${UNINSTALL_K3S_SH} >/dev/null << EOF #!/bin/sh set -x -[ \`id -u\` = 0 ] || exec sudo \$0 \$@ +[ \`id -u\` -eq 0 ] || exec sudo \$0 \$@ ${BIN_DIR}/${KILLALL_K3S_SH}