From 6f9c3ed1992bf8a1caece1552a421f75fc3e4575 Mon Sep 17 00:00:00 2001 From: lizw <1183409807@qq.com> Date: Sun, 30 Oct 2022 17:10:49 +0800 Subject: [PATCH] 07env-install-centos.sh --- 00base/07env-install-centos.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/00base/07env-install-centos.sh b/00base/07env-install-centos.sh index d2ee8cc..f87aed9 100644 --- a/00base/07env-install-centos.sh +++ b/00base/07env-install-centos.sh @@ -231,13 +231,13 @@ function init:add_user() { local add_sudoers="${ADD_USER_NAME} ALL=(ALL) NOPASSWD:ALL" command::exec "${host}" " id -u ${ADD_USER_NAME} >/dev/null 2>&1 - if [ \$? -ne 0 ]; then + if [ \$? -ne '0' ]; then # 创建用户 adduser ${ADD_USER_NAME} # 设置密码 echo ${ADD_USER_NAME}:${ADD_USER_PASSWORD} | chpasswd fi - if [ \`grep -c '$add_sudoers' '/etc/sudoers'\` -ne 0 ];then + if [ \`grep -c '$add_sudoers' '/etc/sudoers'\` == '0' ];then # 新增修改权限 chmod -v u+w /etc/sudoers echo -e \"\n$add_sudoers\n\" >> /etc/sudoers