Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wget or curl throws -bash: syntax error near unexpected token `('

Tags:

wget

I am trying to download a file which has symbol "(" in it;s URL. I tried using wget and curl. Bash is not allowing it to be processed and throws "-bash: syntax error near unexpected token `('".

Any idea how to resolve it?

like image 808
shekar Avatar asked Dec 12 '17 14:12

shekar


4 Answers

You should escape the character by adding a "\" before it. Like \( or \)

like image 124
Benjamin Smith Avatar answered Nov 15 '22 18:11

Benjamin Smith


Add single quotes ' or double quotes " around the URL.

like image 40
Vishrant Avatar answered Nov 15 '22 18:11

Vishrant


I hope someone found this useful.

In my case, I want to curl this file name data (1).rar

then it should be write like this in the terminal

http://example.com/data%20\(1\).rar
like image 1
Snowbases Avatar answered Nov 15 '22 18:11

Snowbases


I encountered the same problem and solved that issue just by adding double quotes to the command what I am passing. for eg:

git checkout "<branch_name>"

like image 1
fzee07 Avatar answered Nov 15 '22 20:11

fzee07