以下内容是关于云计算学习路线源码框架笔记内容,下面是关于while循环结构的内容:
while 条件
do
循环体
done
完善系统工具的输出及可操作性
#!/usr/bin/env bash
#
Author: bavdu
Email: bavduer@163.com
Github: https://github.com/bavdu
Date: 2019//
while 1>0
do
cat <<-EOF
+-------------------------------------------------------------------------+
| System_tools V1.0 |
+-------------------------------------------------------------------------+
| a. Stop And Disabled Firewalld. |
| b. Disabled SELinux Secure System. |
| c. Install Apache Service. |
| d. Quit |
+-------------------------------------------------------------------------+
EOF
printf "\e[1;35m Please input your select: \e[0m" && read var
case "$var" in
"a")
systemctl stop firewalld && systemctl disable firewalld
;;
"b")
sed -ri s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
;;
"c")
yum -y install httpd httpd-tools
;;
"d")
exit
;;
*)
printf "请按照上方提供的选项输入!!!\n"
;;
esac
if [ $? -eq 0 ];then
clear
else
printf "\e[1;31m Warning: Your program exist ERROR!!! \e[0m\n"
break
fi
done