LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 07: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, 09:03 PM   #2
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

Rep: Reputation: 385Reputation: 385Reputation: 385Reputation: 385
Looks like it is missing the ; somewhere.
 
Old 11-23-2011, 05:53 AM   #3
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
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, 08:56 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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, 09:07 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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, 11:10 AM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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, 06: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



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 04:40 PM
syntax error near unexpected token `newline' rcmonroig Linux - Software 2 07-22-2011 12:43 AM
error: unexpected token `newline' CarlosV Programming 4 05-17-2011 03:47 AM
syntax error near unexpected token `newline' uhollins Linux - Newbie 6 12-04-2008 01:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:58 PM.

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