wget: how to handle urls with ampersands

The url that you want to get with wget looks like this i.e. has & in the query string.

http://hostname/path?account=abc&user=joe

Calling wget like this will not work

wget http://hostname/path?account=abc&user=joe

But the following will work nicely

URL="http://hostname/path?account=abc&user=joe"; wget "$URL"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s