From 70a46830675edb5dc93ed341f580c3335ba3d1c8 Mon Sep 17 00:00:00 2001 From: lizw <1183409807@qq.com> Date: Sun, 30 Oct 2022 17:03:22 +0800 Subject: [PATCH] 07env-install-centos.sh --- 00base/07env-install-centos.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/00base/07env-install-centos.sh b/00base/07env-install-centos.sh index 5e7d959..cf3f929 100644 --- a/00base/07env-install-centos.sh +++ b/00base/07env-install-centos.sh @@ -237,7 +237,8 @@ function init:add_user() { # 设置密码 echo ${ADD_USER_NAME}:${ADD_USER_PASSWORD} | chpasswd fi - if [ \`grep -c '$add_sudoers' '/etc/sudoers'\` -ne '0' ];then + grep -c '$add_sudoers' '/etc/sudoers' + if [ \$? -ne 0 ];then # 新增修改权限 chmod -v u+w /etc/sudoers echo -e \"\n$add_sudoers\n\" >> /etc/sudoers