Nested 'case' statements where the user can return to the outer one from the inner one
-1
votes
1
answer
138
views
I am trying to put a
case
statement inside another case
statement, but I want the user to be able to return to the first case
statement if they want.
The idea is something like this:
-bash
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
Asked by zellez11
(147 rep)
Jan 6, 2020, 01:41 AM
Last activity: May 14, 2024, 01:48 PM
Last activity: May 14, 2024, 01:48 PM