2つのCaseステートメントが互いにネストされており、最初のCaseを返したいと思います。

2つのCaseステートメントが互いにネストされており、最初のCaseを返したいと思います。

私はこのような他のケースの中にケースを挿入したいと思っています。

read choice
case $choice in
    1)
       read pattern
       case $pattern in

              pattern1)
                      Statement()
                      ;;

              pattern2)
                      Statement(return to the first case)
                      ;;

            *)
            echo "Error"
            ;;
            esac

            ;;

    2)

            echo "test"
            ;;

    3)

            break
            ;;

            *)
            echo "error"
            ;;
            esac

ベストアンサー1

このように:

while true; do
   read -rp "Your Question? [1|2|3] " choice
   case $choice in

おすすめ記事