From 470500cc0db33943b9b653aa4dd0a4b52d3c0445 Mon Sep 17 00:00:00 2001 From: lsy Date: Tue, 24 Sep 2024 18:29:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/User/user.sh | 4 ++-- Menus/Install.sh | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Config/User/user.sh b/Config/User/user.sh index 985ca08..1125928 100644 --- a/Config/User/user.sh +++ b/Config/User/user.sh @@ -77,8 +77,8 @@ case $pick in echo "系统内没有该用户" exit fi - sed -i "s/^#\?$user_name.*/d" /etc/sudoers - pkill -u root + sed -i "s/^#\?$user_name.*/d" /etc/sudoers &> /dev/null + pkill -u $user_name userdel -r $user_name &> /dev/null rm -rf "/home/${user_name}" echo "用户删除成功" diff --git a/Menus/Install.sh b/Menus/Install.sh index 98667ba..965b3c1 100644 --- a/Menus/Install.sh +++ b/Menus/Install.sh @@ -1,12 +1,16 @@ #!/bin/bash +if [[ $UID != 0 ]]; then + echo "请以root权限执行该脚本" + exit +fi if ! command -v git &> /dev/null; then if [[ -f "/usr/bin/apt-get" ]];then apt-get update -y - apt-get install git + apt-get install git -y elif [[ -f "/usr/bin/apt" ]];then apt update -y - apt install git + apt install git -y elif [[ -f "/usr/bin/pacman" ]];then pacman -Syu --noconfirm pacman -Sy --noconfirm git