对无效输出条件重复一个特定的case语句并在case中循环

时间:2018-02-26 10:23:36

标签: linux bash shell if-statement switch-statement

我有一个案例陈述,如1)2)3)......如下所示,1)格式案例中有多个if else条件。 我想在无效条件下重复这个特例。 当用户首先选择1时,它会询问果汁的名称。 接下来它询问可用性。如果是,则继续请求计数并进行操作。如果操作"退出0"它只是打印完成。如果操作"退出1"我希望循环从顶部继续,即来自果汁的名称?"

1)
echo "Name of the Juice ?"
read juice
echo "Is it available? [Y/N]"
read deci
if [ "$deci" = "N" ]
then
echo "Continue.!"
else
echo "how many left in the warehouse ?"
read left
I have a command here which exits 0 or 1
if [ $? -eq 0 ]; then
echo "done"
else 
<I have to continue from the start [ie;name of the juice]>
fi
fi
;;
echo "Name of the Pizza ?"
read juice
echo "Is it available? [Y/N]"
read deci
if [ "$deci" = "N" ]
then
echo "Continue.!"
else
echo "how many left ?"
read left
I have a command here which exits 0 or 1
if [ $? -eq 0 ]; then
echo "done"
else 
<I have to continue from the start [ie;name of the juice]>
fi
fi
;;

0 个答案:

没有答案