我正在尝试将一个 case 语句放入另一个像这样的 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