Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 01-14-2007, 10:56 AM   #1
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" ]
echo "User chose Yes"
echo "User chose No"

case "$choice" in
echo "Y chosen"
echo "N chosen"
echo "You are leaving the lair!"
Old 01-15-2007, 04:50 AM   #2
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
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

All times are GMT -5. The time now is 03:34 PM.

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