2017-05-24 68 views
0

所以,我试图为我的程序做一个安装向导。 然而,如果你输入“n”,它会询问你是否确定是否要取消,但是当你按下“n”时,我希望它回到顶端。这可能吗?安装向导重启

echo "Would you like to start the NJDTL Install Wizard? [y/n]" 
read startYN 
if [ $startYN == y ] 
    then 
     echo "Starting Install Wizard. . ." 
     mkdir ~/.NJDTL 
    fi 
    if [ $startYN == n ] 
     then 
      echo "Are you sure you want to cancel the Install Wizard? [y/n]" 
      read CancelConfirm 
      if [ $CancelConfirm = y ] 
      then 
       echo "Cancelling Install. . ." 
       exit 
       fi 
      if [ $CancelConfirm = n ] 
      then 
       echo "Chose "n". Continuing Installation. . ." 
     fi 

回答

1

要重新启动脚本:

exec $0 

更新 - 保存在命令行中,你可以使用:

exec $0 "[email protected]" 
+0

它的工作,谢谢! – GlitchyShadowZ