本脚本用于练习if .....then....elif......else的基本用法

#!/bin/bash
#new script for study
#create time 2010/8/25
#made by chenbaocheng
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

echo "Welcome to CBC system"
read -p "Please input you id==>:" id
test -z $id && echo "You must input you id!" && exit 0
read -p "Please input you password==>:" pwd
test -z $pwd && echo "You must input you password" && exit 0

echo "OK,Please input you information"
read -p "Plase input you name==>:" name
test -z $name && echo "You must input you name!" && exit 0

read -p "can I help you?==>" help1
test -z $help1 && echo "you must have a choice!" && exit 0
if [ "$help1" = "y" ] || [ "$help1" = "yes" ] || [ "$help1" = "Y" ] || [ "$help1" = "YES" ]; then
echo "Ok,continue"
elif [ "$help1" = "n" ] || [ "$help1" = "no" ] || [ "$help1" = "N" ] || [ "$help1" = "NO" ]; then
echo "you must input yes or no ?"
else
echo "I don't Know what is your choise"
fi
read -p "Is this your first script?===>" yorn
test -z $yorn && echo "you must input y or n" && exit 0
if [ "$yorn" = "y" ] || [ "$yorn" = "Y" ]; then
echo "Going"
elif [ "$yorn" = "n" ] || [ "$yorn" = "N" ]; then
echo "you are a bad man"
else
echo "byebye"
fi