Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Escaping in wget bash command

wget -q -T 60 --retry-connrefused -t 5 --waitretry=60 --user=ftp2.company.com|company2013 --password=!company2013 -N -P data/parser/company/ ftp://ftp2.company.com/Production/somedata.zip

I'm having trouble with this command, because the password contains an exclamation mark. I tried escaping with \, tried single quotes, and it either gives the output:

wget: missing URL

or

bash: !company2013: event not found

This is really demotivating...

like image 807
Innkeeper Avatar asked Sep 05 '25 03:09

Innkeeper


1 Answers

Perhaps this part needs to be quoted to prevent it from being seen as a pipe to another command.

--user='ftp2.company.com|company2013'

And this one too to prevent history expansion with !:

--password='!company2013'

Final:

wget -q -T 60 --retry-connrefused -t 5 --waitretry=60 --user='ftp2.company.com|company2013' --password='!company2013' -N -P data/parser/company/ ftp://ftp2.company.com/Production/somedata.zip

And it's also a good idea to quote the other parts if on later time they have spaces:

wget -q -T 60 --retry-connrefused -t 5 --waitretry=60 --user='ftp2.company.com|company2013' --password='!company2013' -N -P "data/parser/company/" "ftp://ftp2.company.com/Production/somedata.zip"
like image 174
konsolebox Avatar answered Sep 07 '25 20:09

konsolebox