#!/bin/bash
#
#管理员密码
Passwd=$(/usr/bin/osascript -e 'display dialog "请输入管理员密码" with hidden answer default answer "" with icon note buttons {"Continue"} default button "Continue"
set result1 to result
set the text_data to text returned of the result
set the button_data to button returned of the result1
if button_data = "Cancel" then
return ""
end if
return text_data')
if [ -z "$Passwd" ];then
exit 0;
fi
if [ $Passwd = 'aaaaaaaa' ]; then
userName=$(/usr/bin/osascript -e 'display dialog "请输入用户名,一般是JS-工号,可在 /Users/ 目录下面查看" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"
set the date_data to text returned of the result
return date_data')
sudo dscl . -append /Groups/admin GroupMembership $userName
$(/usr/bin/osascript -e 'display dialog "操作成功,请重启电脑!" buttons {"OK"} default button "OK"')
echo "OK";
fi
#!/bin/bash
#
#管理员密码
Passwd=$(/usr/bin/osascript -e 'display dialog "请输入管理员密码" with hidden answer default answer "" with icon note buttons {"Continue"} default button "Continue"
set result1 to result
set the text_data to text returned of the result
set the button_data to button returned of the result1
if button_data = "Cancel" then
return ""
end if
return text_data')
if [ -z "$Passwd" ];then
exit 0;
fi
if [ $Passwd = 'aaaaaaaa' ]; then
userName=$(/usr/bin/osascript -e 'display dialog "请输入用户名,一般是JS-工号,可在 /Users/ 目录下面查看" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"
set the date_data to text returned of the result
return date_data')
sudo dscl . -delete /Groups/admin GroupMembership $userName
$(/usr/bin/osascript -e 'display dialog "操作成功,请重启电脑!" buttons {"OK"} default button "OK"')
echo "OK";
fi