LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-22-2011, 08:14 PM   #1
yusvian
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Rep: Reputation: Disabled
syntax error near unexpected token 'newline'


i had copy of antivir-workstation-pers-<3.1.3.5-0> in folder home/yusvian/Download
i made a script to install it but always get respons :
bash: syntax error near unexpected token 'newline'
my script is : cd Downloads/antivir-workstation-pers-<3.1.3.5-0>
somebody please help me
 
Old 11-22-2011, 10:03 PM   #2
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Looks like it is missing the ; somewhere.
 
Old 11-23-2011, 06:53 AM   #3
Brains
Member
 
Registered: Apr 2009
Distribution: Debian testing
Posts: 361

Rep: Reputation: 76
If you click on 'Post Reply' instead of 'Quick reply', you'll see a hash (#) in the tools menu which will wrap CODE tags around selected text.
It would be best if you were to post the full contents of your scrip and highlight it, then click on the hash to wrap CODE tags around it. This way we can see exactly how your script is put together in order to troubleshoot it.

From what I see so far, you have a Download folder, but you say your script prompts to change into a Downloads folder (plural). Is this the problem or a typo?
 
Old 11-23-2011, 09:56 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
More generally, the shell has already told you what the problem is, if not where. It's a syntax error, and it has something to do with it coming across a newline where there shouldn't be one.

So start going through the script line by line, and search for syntax errors. Focus on things like improperly quoted strings and variables, improperly closed commands, and, as mentioned, missing semicolons.

Sometimes solving a bug simply requires the grunt work of slogging through the code.
 
Old 11-23-2011, 10:07 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Also make sure you didn't edit this file in Windows. If you have, use dos2unix to convert it, removing the extra \r characters.
 
Old 11-23-2011, 12:10 PM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,116

Rep: Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339Reputation: 1339
Quote:
Originally Posted by yusvian View Post
i had copy of antivir-workstation-pers-<3.1.3.5-0> in folder home/yusvian/Download
i made a script to install it but always get respons :
bash: syntax error near unexpected token 'newline'
my script is : cd Downloads/antivir-workstation-pers-<3.1.3.5-0>
somebody please help me
The '>' and '<' characters have special meaning for the shell and need to be quoted.
Code:
cd "Downloads/antivir-workstation-pers-<3.1.3.5-0>"
 
Old 11-23-2011, 07:56 PM   #7
yusvian
LQ Newbie
 
Registered: Nov 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
syntax error solved

thank you all. i had solved the problem. simply by deleting <> in the script. my new script is :
cd Downloads/antivir-workstation-pers-3.1.3.5-0
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Syntax erroronear unexpected token `newline' noeleo Linux - Software 3 11-11-2011 05:40 PM
syntax error near unexpected token `newline' rcmonroig Linux - Software 2 07-22-2011 01:43 AM
error: unexpected token `newline' CarlosV Programming 4 05-17-2011 04:47 AM
syntax error near unexpected token `newline' uhollins Linux - Newbie 6 12-04-2008 02:18 PM


All times are GMT -5. The time now is 03:03 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration