LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-14-2007, 10:56 AM   #1
deskjockey39
LQ Newbie
 
Registered: Jan 2007
Location: California
Posts: 2

Rep: Reputation: 0
syntax error near unexpected token


I am brand new at scripting and am having some trouble with syntax errors. I am trying to run a simple script game but get the follwing error: syntax error near unexpected token 'Y>'

Here is script, any help or advice is appreciated.

echo "You have entered the world of the Dragon Slayer"
echo " Do you wish to continue?"
read choice
if [ $choice = "Y" ]
then
echo "User chose Yes"
else
echo "User chose No"
fi

case "$choice" in
Y>
echo "Y chosen"
./dragonslayer1
;;
N>
echo "N chosen"
./dragonslayer2
;;
exit>
echo "You are leaving the lair!"
 
Old 01-15-2007, 04:50 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
In your case statement, each choice should be followed by a right parenthesis, not an angle bracket (greater than sign). You have also forgotten to end your case statement with an esac.
 
Old 01-16-2007, 08:47 AM   #3
deskjockey39
LQ Newbie
 
Registered: Jan 2007
Location: California
Posts: 2

Original Poster
Rep: Reputation: 0
Syntax Error

That did the trick. Thank you for the help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax error near unexpected token `fi' Warmduvet Programming 21 10-08-2013 10:28 AM
syntax error for unexpected token `(' Steve Spurr Linux - Newbie 6 09-22-2006 08:19 AM
syntax error near unexpected token `else' josedias Programming 3 09-11-2006 07:09 PM
Trouble with Bash -- syntax error near unexpected token `fi' anamericanjoe Programming 5 05-19-2006 02:59 PM
syntax error near unexpected token ` mattyspatty Programming 8 05-07-2006 05:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration