以下是一直不斷給我提出問題的代碼片段。有人可以向我解釋爲什麼我的代碼無法正常工作。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