1、
#!/bin/bash
#Program:
# This program shows the user's choice
#History:
# 2013/08/26 ydonghao
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
read -p "Please input (Y/N): " a
echo $a
[ $a=Y -o $a=y ] && echo "OK, continue" && exit 0
[ $a=N -o $a=n ] && echo "Oh, interrupt" && exit 0
echo "I don't know what your choice is" && exit 0
2、
#!/bin/bash
#Program:
# This program shows the user's choice
#History:
# 2013/08/26 ydonghao
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
read -p "Please input (Y/N): " yn
if [ "$yn" = "Y" ] || [ "$yn" = "y" ]; then
echo "OK; continue "
exit 0;
fi
if [ "$yn" = "N" ] || [ "$yn" = "n" ]; then
echo "oh, interrupt "
exit 0;
fi
echo "I don't know what your choice is" && exit 0