[root@es3 data]# cat case11.sh
#!/bin/bash
. /etc/rc.d/init.d/functions
disable_selinux(){
sed -i 's/SELNUX=enforcing/SELINUX=disabled/' /etc/selinux/config
action "SELINUX 已经禁用,重启生效"
}
disable_firewalld(){
systemctl disable --now firewalld &> /dev/null
action "防火墙已经禁用"
}
PS3="请选择相应的编号(1-4):"
MENU='
禁用SELINUX
关闭防火墙
以上全实现
退出
'
select M in $MENU ;do
case $REPLY in
1)
disable_selinux
;;
2)
disable_firewalld
;;
3)
disable_selinux
disable_firewalld
;;
4)
break
;;
*)
echo "请输入正确的数字"
esac
done