When i Choose from The main Menu I Get: game.sh: 423: Syntax error: end of file unexpected (expecting "fi") [closed]
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question!# /bin/sh
# game.sh:
# Chooses games based on genre and title
# Also Shows descriptions of games
# Genre Menu
clear
printf "%s\n" "Game genre Menu"
printf "%s\n"
printf "%s\n" "1. First Person Shooter"
printf "%s\n" "2. Arcade"
printf "%s\n" "3. RPG"
printf "%s\n" "4. RPG (Infocom A-Jo)" #1-12
printf "%s\n" "5. RPG (Infocom Le-St)" #13-24
printf "%s\n" "6. RPG (Infocom Su-Zo)" #25-36
printf "%s\n" "7. RPG (Infocom ZZinvisiclues)" #37-45
read -p "Enter Number: " GENRE
if [ $GENRE = 1 ]
then
# Menu for First Person Shooters
clear
printf "%s\n" "First Person Shooter Menu"
printf "%s\n"
printf "%s\n" "1. DOOM"
printf "%s\n" "2. DOOM II"
printf "%s\n" "3. Final DOOM (TNT)"
printf "%s\n" "4. Final DOOM (Plutonia)"
printf "%s\n" "5. Quake"
printf "%s\n" "6. Duke Nukem 3D Atomic Edition"
printf "%s\n" "7. Heretic"
printf "%s\n" "8. Hexen"
printf "%s\n" "9. Shadow Warrior"
read -p "Enter Number: " FPSGAME
# FPSGAME Choices
if [ $FPSGAME = 1 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/doom/prboom/
./prboom
elif [ $FPSGAME = 2 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/doom2/prboom/
./prboom
elif [ $FPSGAME = 3 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/tnt/prboom/
./prboom
elif [ $FPSGAME = 4 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/plutonia/prboom/
./prboom
elif [ $FPSGAME = 5 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/sdlquake/
./sdlquake
elif [ $FPSGAME = 6 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/eduke32/
./eduke32
elif [ $FPSGAME = 7 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/hheritic-0.2.0-src/
./hheretic-sdl
elif [ $FPSGAME = 8 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/hhexen-1.6.0/
./hhexen-sdl
elif [ $FPSGAME = 9 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/Shadow_Warrior/
./sw
else
printf "%s\n" "Oops! Unknown Selection."
fi
elif [ $GENRE = 2 ]
then
# Menu for Arcade
clear
printf "%s\n" "Arcade Menu"
printf "%s\n"
printf "%s\n" "1. ASCII Portal"
printf "%s\n" "2. Dave Gnukem"
printf "%s\n" "3. Open Liero"
printf "%s\n" "4. Open Tyrian"
printf "%s\n" "5. PowerManga"
printf "%s\n" "6. Asteroids"
printf "%s\n" "7. Spout"
printf "%s\n" "8. TCGS Car"
read -p "Enter Number: " ARCGAME
# ARCGAME Choices
开发者_如何学运维 if [ $ARCGAME = 1 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/asciiportal/
./asciiportal
elif [ $ARCGAME = 2 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/DaveGnukem/
./davegnukem.dge
elif [ $ARCGAME = 3 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/openliero/
./liero1.34
elif [ $ARCGAME = 4 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/opentyrian
./opentyrian.dge
elif [ $ARCGAME = 5 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/powermanga
./powermanga
elif [ $ARCGAME = 6 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/sdlroids
./sdlroids
elif [ $ARCGAME = 7 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/spout/
./spout
elif [ $ARCGAME = 8 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/tcgs_car/
./tcgs_Car
else
printf "%s\n" "Oops! Unknown Selection."
fi
elif [ $GENRE = 3 ]
then
# Menu for RPG
clear
printf "%s\n" "RPG Menu"
printf "%s\n"
printf "%s\n" "1. Meritous"
printf "%s\n" "2. Nethack"
printf "%s\n" "3. Powder"
read -p "Enter Number: " RPGGAME
# RPGGAME Choices
if [ $RPGGAME = 1 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/meritous/
./meritous.dge
elif [ $RPGGAME = 2 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/nethack-3.4.3-nanonote-bin/
./nethack
elif [ $RPGGAME = 3 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/powder
./powder
else
printf "%s\n" "Oops! Unknown Selection."
fi
elif [ $GENRE = 4 ]
then
# Menu for RPG (Infocom A-Jo)
clear
printf "%s\n" "RPG {Infocom A-Jo) Menu"
printf "%s\n"
printf "%s\n" "1. A Mind Forever Voyaging (1985)"
printf "%s\n" "2. Arthur (1989)"
printf "%s\n" "3. Ballyhoo (1986)"
printf "%s\n" "4. Beyond Zork: The Coconut of Quendor (1987)"
printf "%s\n" "5. Border Zone (1987)"
printf "%s\n" "6. Bureaucracy (1987)"
printf "%s\n" "7. Cutthroats (1984)"
printf "%s\n" "8. Deadline (1982)"
printf "%s\n" "9. Enchanter (1983)"
printf "%s\n" "10. Hollywood Hijinx (1986)"
printf "%s\n" "11. Infidel (1983)"
printf "%s\n" "12. Journey (1989)"
read -p "Enter Number: " INFOAJGAME
# INFOAJGAME Choices
if [ $INFOAJGAME = 1 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/A_Mind_Forever_Voyaging/Amfv.z4
elif [ $INFOAJGAME = 2 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Arthur/ARTHUR.Z6
elif [ $INFOAJGAME = 3 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Ballyhoo/Ballyhoo.z3
elif [ $INFOAJGAME = 4 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Beyond_Zork_The_Coconut_of_Quendor/BeyondZo.z5
elif [ $INFOAJGAME = 5 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Border_Zone/Borderzo.z5
elif [ $INFOAJGAME = 6 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Bureaucracy/BureaucrPATCHED.z4
elif [ $INFOAJGAME = 7 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Cutthroats/Cutthroa.z3
elif [ $INFOAJGAME = 8 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Deadline/Deadline.z3
elif [ $INFOAJGAME = 9 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Enchanter/Enchante.z3
elif [ $INFOAJGAME = 10 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Hollywood_Hijinx/Hollywoo.z3
elif [ $INFOAJGAME = 11 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Infidel/Infidel.z3
elif [ $INFOAJGAME = 12 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
./frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Journey/Journey.z6
else
printf "%s\n" "Oops! Unknown Selection."
fi
elif [ $GENRE = 5 ]
then
# Menu for RPG (Infocom Le-St)
clear
printf "%s\n" "RPG {Infocom Le-St) Menu"
printf "%s\n"
printf "%s\n" "1. Leather Goddesses of Phobos (1986)"
printf "%s\n" "2. Moonmist (1986)"
printf "%s\n" "3. Nord and Bert Couldn't Make Head or Tail of It (1987)"
printf "%s\n" "4. Planetfall (1983)"
printf "%s\n" "5. Plundered Hearts (1987)"
printf "%s\n" "6. Seastalker (1984)"
printf "%s\n" "7. Sherlock: The Riddle of the Crown Jewels (1987)"
printf "%s\n" "8. Shogun (1988)"
printf "%s\n" "9. Sorcerer (1984)"
printf "%s\n" "10. Spellbreaker (1985)"
printf "%s\n" "11. Starcross (1982)"
printf "%s\n" "12. Stationfall (1987)"
read -p "Enter Number: " INFOLSGAME
# INFOLSGAME Choices
if [ $INFOLSGAME = 1 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Leather_Goddesses_of_Phobos/Leather.z3
if [ $INFOLSGAME = 2 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Moonmist/Moonmist.z3
if [ $INFOLSGAME = 3 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Nord_and_Bert_Couldnt_Make_Head_or_Tail_of_It/Nordandb.z4
if [ $INFOLSGAME = 4 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Planetfall/Planetfa.z3
if [ $INFOLSGAME = 5 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Plundered_Hearts/Plundere.z3
if [ $INFOLSGAME = 6 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Seastalker/Seastalk.z3
if [ $INFOLSGAME = 7 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Sherlock_The_Riddle_of_the_Crown_Jewels/Sherlock.z5
if [ $INFOLSGAME = 8 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Shogun/Shogun.z6
if [ $INFOLSGAME = 9 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Sorcerer/Sorcerer.z3
if [ $INFOLSGAME = 10 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Spellbreaker/Spellbre.z3
if [ $INFOLSGAME = 11 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Starcross/Starcros.z3
if [ $INFOLSGAME = 12 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Stationfall/Stationf.z3
else
printf "%s\n" "Oops! Unknown Selection."
fi
elif [ $GENRE = 6 ]
then
# Menu for RPG (Infocom Su-Zo)
clear
printf "%s\n" "RPG (Infocom Su-Zo) Menu"
printf "%s\n"
printf "%s\n" "1. Suspect (1984)"
printf "%s\n" "2. Suspended (1983)"
printf "%s\n" "3. The Hitchhikers Guide To The Galaxy (1987)"
printf "%s\n" "4. The Lurking Horror (1984)"
printf "%s\n" "5. The Witness (1982)"
printf "%s\n" "6. Trinity (1986)"
printf "%s\n" "7. Wishbringer (1985)"
printf "%s\n" "8. Zork 1: The Great Underground Empire (1981)"
printf "%s\n" "9. Zork 2: The Wizard of Frobozz (1981)"
printf "%s\n" "10. Zork 3: The Dungeon Master (1982)"
printf "%s\n" "11. Zork: The Undiscovered Underground (1997)"
printf "%s\n" "12. Zork Zero: The Revenge of Megaboz (1988)"
read -p "Enter Number: " INFOSZGAME
# INFOSZGAME Choices
if [ $INFOSZGAME = 1 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Suspect/Suspect.z3
if [ $INFOSZGAME = 2 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Suspended/Suspend.z3
if [ $INFOSZGAME = 3 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/The_Hitchhikers_Guide_To_The_Galaxy/Hitchhik.z5
if [ $INFOSZGAME = 4 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/The_Lurking_Horror/Lurking.z3
if [ $INFOSZGAME = 5 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/The_Witness/Witness.z3
if [ $INFOSZGAME = 6 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Trinity/Trinity.z4
if [ $INFOSZGAME = 7 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Wishbringer/Wishbrin.z3
if [ $INFOSZGAME = 8 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Zork_1_The_Great_Underground_Empire/Zork1.z3
if [ $INFOSZGAME = 9 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Zork_2_The_Wizard_of_Frobozz/Zork2.z3
if [ $INFOSZGAME = 10 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Zork_3_The_Dungeon_Master/Zork3.z3
if [ $INFOSZGAME = 11 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Zork_The_Undiscovered_Underground/ZTUU.Z5
if [ $INFOSZGAME = 12 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Zork_Zero_The_Revenge_of_Megaboz/Zork0.z6
else
printf "%s\n" "Oops! Unknown Selection."
fi
elif [ $GENRE = 7 ]
then
# Menu for RPG (Infocom ZZinvisiclues)
clear
printf "%s\n" "RPG (Infocom ZZinvisiclues) Menu"
printf "%s\n"
printf "%s\n" "1. advntizm"
printf "%s\n" "2. comdyizm"
printf "%s\n" "3. diversizm"
printf "%s\n" "4. fant1izm"
printf "%s\n" "5. fant2izm"
printf "%s\n" "6. hitchhik"
printf "%s\n" "7. mystizm"
printf "%s\n" "8. scifizm"
read -p "Enter Number: " INFOZZGAME
# INFOZZGAME Choices
if [ $INFOZZGAME = 1 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/zzInvisiclues/advntizm.z5
if [ $INFOZZGAME = 2 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/zzInvisiclues/comdyizm.z5
if [ $INFOZZGAME = 3 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/zzInvisiclues/diversizm.z5
if [ $INFOZZGAME = 4 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/zzInvisiclues/fant1izm.z5
if [ $INFOZZGAME = 5 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/zzInvisiclues/fant2izm.z5
if [ $INFOZZGAME = 6 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/zzInvisiclues/hitchhik.z5
if [ $INFOZZGAME = 7 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/zzInvisiclues/mystizm.z5
if [ $INFOZZGAME = 8 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/zzInvisiclues/scifizm.z5
else
printf "%s\n" "Oops! Unknown Selection."
fi
fi
You must end all if statements with a fi
. Seems to me that you might want an elif
instead of if
there where it says if [ $INFOLSGAME = 2 ]
, and also for subsequent alternatives. A switch statement might be better suited for this type of situation.
# INFOLSGAME Choices
if [ $INFOLSGAME = 1 ]
then
cd /mnt/mmcblk0p1/BKUP/Games/frotz/
.frotz /mnt/mmcblk0p1/BKUP/Games/frotz/infocom/Leather_Goddesses_of_Phobos/Leather.z3
if [ $INFOLSGAME = 2 ]
then
...
fi
is the closing tag to if
in bash shell scripting. This means one of your if
statements is unmatched to a fi
. Find this without line numbers is hard.
精彩评论