bash: syntax error near unexpected token `('

I am trying to download flareget download manager via wget I get error

wget (stable)_deb.tar.gz
bash: syntax error near unexpected token `('

Why is that error coming and what is the solution for that?

1

3 Answers

You should use single quotes ' or double quotes " around the URL in this case (and in general):

wget '(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)
1

It's because of the brackets. You need to escape them like this:

wget (stable\)_deb.tar.gz

Now it should work.

Mine had nothing to do with un-escaped brackets and everything to do with an alias already being defined with the same name as the function.

Alias in one file:

alias foo="echo do something"

Function in another:

foo() { # Do something else
}

Both of these files were sourced by my ~/.bashrc, giving me the unhelpful error message:

syntax error near unexpected token (
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like