shell-scripts/tutorials/basic/09-ans-yn-3.sh

16 lines
401 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#Program:
# 这个程序是对07-ans-yn.sh的改进版本使用条件判断式-if
#History:
# 2024/07/14 LouisFonda<yigencong@yahoo.com>
read -p "请输入:" yn
if [ "${yn}" == 'y' ] || [ "${yn}" == 'Y' ]; then
echo "你确认了!"
exit 0
elif [ "${yn}" == 'n' ] || [ "${yn}" == 'N' ]; then
echo "你拒绝了!"
exit 0
else
echo "我不理解你的输出!" && exit 0
fi