以下是一直不断给我提出问题的代码片段。有人可以向我解释为什么我的代码无法正常工作。Bash Shell脚本错误:意外令牌附近的语法错误'{
# Shell Version of Login Menu
Administrator()
{
clear
./Administrator.sh
}
# ------ Student User Menu ------
Student_Menu()
{
clear
./studentMenu.sh
}
# ------ Borrow Menu ------
Borrow_Menu()
{
clear
./BorrowBookMenu.sh
}
# ============================================
# ------ Main Menu Function Definition -------
# ============================================
menu()
{
echo ""
echo "1. Administrator"
echo ""
echo "2. Student user"
echo ""
echo "3. Guest"
echo ""
echo "4. Exit"
echo ""
echo "Enter Choice: "
read userChoice
if ["$userChoice" == "1"]
then
Administrator
fi
if ["$userChoice" == "2"]
then
Student_Menu
fi
if ["$userChoice" == "3"]
then
Borrow_Menu
fi
if ["$userChoice" == "4"]
then
echo "GOODBYE"
sleep
exit 0
fi
echo
echo ...Invalid Choice...
echo
sleep
clear
menu
}
# Call to Main Menu Function
menu
嘿朱利安。我建议你把这个剧本分成小块。单独运行每个块,直到找出错误的来源。 – jkndrkn