这篇文章是云核算学习路程教程代码笔记,关于case的多条件判别语法。
11.*)
- 无匹配后指令序列
13.esac
榜首行: 声明case关键字调用case语法, 紧跟的“变量”一般为用户的输入值, in代表从下方的各个方法来进行匹配
第2-4行: 匹配到“方法1”后进行指令的输出或实施, 方法1: 一般为字符或数值
第11-12行: 当用户输入的字符不存在匹配方法时, 直接实施或打印*)下的指令或句子
开发体系东西
[root@bavdu shell_s]# vim system_tools
#!/usr/bin/env bash
#
Author: bavdu
Email: bavduer@163.com
Github: https://github.com/bavdu
Date: 2019//
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;31m 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
发表评论