#!/bin/bash
echo "请输入:yes|no"
read command
if [ "$command" = "yes" ] || [ "$command" = "YES" ]; then
echo "yes..."
else
echo "no..."
fi
echo "请输入条件:if|elif|else"
read condition
if [ "$condition" = "if" ] ; then
echo "----if----"
elif [ "$condition" = "elif" ]; then
echo "----elif----"
else
echo "----else----"
fi
echo "请输入CASE:(A|B|C)";
read con
case $con in
A)
echo "AA";;
B)
echo "BB";;
C)
echo "C"
;;
*)
echo "请输入:A|B|C"
exit 1;
esac
echo "done...";
shell if else case用法DEMO,布布扣,bubuko.com
原文:http://blog.csdn.net/kevin_luan/article/details/22823427