if语句相对简单,是一组控制语句,应用如下:
#! /bin/sh
echo -n "is moring? yes or no : "
read text
if [ "$text" = "yes" ]
then
echo "goodmorning!"
elif [ $text = "no" ]
then
echo "goodafter!"
else
echo "please input yes or no"
fi
程序中,使用read接收输入,然后在 if 中 使用 [ 命令比较作出判断,正确为 0 ,错误为 1
293

被折叠的 条评论
为什么被折叠?



