所以,我正在尝试为我的程序创建一个安装向导。 但是,如果你输入“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
答案 0 :(得分:1)
重新启动脚本:
exec $0
更新 - 保留您可以使用的命令行:
exec $0 "$@"