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