1. 程式人生 > >if與case

if與case

ash cas code first redhat hit -a dha rst

#!/bin/bash
if [ $1 -lt 3 ];then
echo redhat
elif [ $1 -eq 3 ];then
echo green
elif [ $1 -gt 3 -a $1 -lt 5 ];then
echo yellow
else
echo white
fi


case $1 in
        1|one|first)echo redhat;;
        2)echo yellow;;
        3)echo green;;
        *)echo blue;;
esac

if與case