shell case

認識case結構bash

[root@localhost test]# cat 5.shide

#!/bin/bashinput

read -t 5 -p "Please input a number: " nit

m=$[$n%2]class

case $m intest

        1)di

        echo "The number is jishu."view

        ;;vi

        0)co

        echo "The number is oushu."

        ;;

        *)

        echo "It is not jishu or oushu."

        ;;

esac

相關文章
相關標籤/搜索