判断输入的是yes还是no
程序员文章站
2022-05-02 08:17:04
...
if写法
#!/bin/bash
read -p "please input yes or no: " YON
if [[ "$YON" =~ ^[Yy][Ee][Ss]$ ]];then
echo "What you type in is: yes"
elif [[ "$YON" =~ ^[Nn][Oo]$ ]];then
echo "What you type in is: no"
else
echo "What you type in is: other"
fi
下一篇: Hibernate级联操作