条件语句练习

#!/bin/sbin
cat <<END
        1.panxiaoting
        2.longzheluola
        3.angelababy
END

read -p "Which do you like? Please input the num:" choice
[ $choice == "1" ] &&{
        echo "I guess, you like panxiaoting!"
        exit 0
}

[ $choice == "2" ] &&{
        echo "I guess, you like longzheluola!"
        exit 0
}

[ $choice == "3" ] &&{
        echo "I guess, you like angelababy!"
        exit 0
}
[ $choice != "1" -o $choice != "2" -o $choice != "3" ] &&{
        echo "I guess, you are not man!"
}

 

posted @ 2017-03-15 15:24  Vincen_shen  阅读(271)  评论(0编辑  收藏  举报