shell case...esac

[dev@abtsvr shellTest]$ vi test7.sh

case $1 in
 one)
        echo "one"
        ;;
 two)
        echo "two"
        ;;
 three)
        echo "three"
        ;;
 *)
        echo "usage{one|two|three|"

        exit 1
esac 

[dev@abtsvr shellTest]$ sh test7.sh
usage{one|two|three|
[dev@abtsvr shellTest]$ sh test7.sh one
one

你可能感兴趣的:(shell)