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
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