Bash Shell Syntax Error Near Unexpected Token
Contents |
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss shell syntax error near unexpected token done' the workings and policies of this site About Us Learn more about syntax error near unexpected token in shell script Stack Overflow the company Business Learn more about hiring developers or posting ads with us Ask Ubuntu Questions syntax error near unexpected token else' in shell script Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign up
Linux Syntax Error Near Unexpected Token Then'
Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top bash: syntax error near unexpected token `(' up vote 4 down vote favorite 2 I am trying to download flareget download manager via wget I get error wget http://www.flareget.com/files/flareget/debs/amd64/flareget_2.3-24_amd64(stable)_deb.tar.gz bash: syntax error near unexpected token `(' Why linux syntax error near unexpected token newline' is that error coming and what is the solution for that? bash scripts wget share|improve this question asked Nov 8 '13 at 10:27 Registered User 1,15472237 add a comment| 2 Answers 2 active oldest votes up vote 6 down vote accepted You should use single quotes ' or double quotes " around the URL in this case (and in general): wget 'http://www.flareget.com/files/flareget/debs/amd64/flareget_2.3-24_amd64(stable)_deb.tar.gz' From now, you should use this method in general when you use a string which contain parentheses as argument in a command. That is because parentheses are used for grouping by the shell such that they are not communicated in any way to a command. So, the bash shell will give you a syntax error: $ echo some (parentheses) bash: syntax error near unexpected token `(' $ echo 'some (parentheses)' some (parentheses) share|improve this answer edited Nov 8 '13 at 11:40 answered Nov 8 '13 at 10:30 Radu Rădeanu 77.6k24168256 add a comment| up vote 2 down vote It's because of the brackets. You need to escape them like this: wget http://www.flareget.com/files/flareget/debs/amd64/flareget_2.3-24_amd64\(stable\)_deb.tar.gz Now it should work
Search HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Non-*NIX Forums > Programming [SOLVED] bash: syntax error syntax error near unexpected token (' in linux near unexpected token `(' User Name Remember Me? Password Programming This forum
Bash Syntax Error Near Unexpected Token R
is for all programming questions. The question does not have to be directly related to Linux and
Syntax Error Near Unexpected Token Bash Function
any language is fair game. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. By joining our community you will http://askubuntu.com/questions/372926/bash-syntax-error-near-unexpected-token have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today! Note that registered members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following links: http://www.linuxquestions.org/questions/programming-9/bash-syntax-error-near-unexpected-token-%60-'-818825/ Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here. Having a problem logging in? Please visit this page to clear all LQ-related cookies. Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive this Complete Guide absolutely f
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the http://stackoverflow.com/questions/5560132/syntax-error-near-unexpected-token workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. syntax error Join them; it only takes a minute: Sign up syntax error near unexpected token `(' up vote 8 down vote favorite 1 I am trying to execute sudo -su db2inst1 /opt/ibm/db2/V9.7/bin/db2 force application (1995) but I get this error bash: syntax error near unexpected token('` sudo -su db2inst1 id gives me correct output. So it must be something about syntax error near the () UPDATE I If I try sudo -su db2inst1 /opt/ibm/db2/V9.7/bin/db2 force application \(1995\) I get /bin/bash: -c: line 0: syntax error near unexpected token `(' /bin/bash: -c: line 0: `/opt/ibm/db2/V9.7/bin/db2 force application (1995)' UPDATE II running /opt/ibm/db2/V9.7/bin/db2 force application (1995) as db2inst1 user gives me the same error but running /opt/ibm/db2/V9.7/bin/db2 "force application (1995)" works fine UPDATE III the right syntax is sudo -su db2inst1 '/opt/ibm/db2/V9.7/bin/db2 "force application (1995)"' bash shell share|improve this question edited Apr 23 '11 at 0:38 Lightness Races in Orbit 216k34332580 asked Apr 6 '11 at 0:19 Radek 6,40735113194 add a comment| 2 Answers 2 active oldest votes up vote 17 down vote accepted Since you've got both the shell that you're typing into and the shell that sudo -s runs, you need to quote or escape twice. (EDITED fixed quoting) sudo -su db2inst1 '/opt/ibm/db2/V9.7/bin/db2 force application \(1995\)' or sudo -su db2inst1 /opt/ibm/db2/V9.7/bin/db2 force application \\\(1995\\\) Out of curiosity, why do you need -s? Can't you just do this: sudo -u db2inst1 /opt/ibm/db2/V9.7/bin/db2 force application \(1995\) share|improve this answer e