Thursday, December 15, 2005

Linux Tips

A friend of mine was having issues using wget. He said that when trying to download images, wget just "hangs". Upon investigation I found that he was not properly quoting the URL and the ampersand character was causing the "hanging up". When using wget to download images that have dynamic URLs (include "?" or "&" in the URL) you must quote the URLs using single or double quotes.


#WRONG
wget http://frankmash.blogspot.com/?i=1&o=2
# RIGHT WAY
wget 'http://frankmash.blogspot.com/?i=1&o=2'



As a rule of thumb, always quote parameters that include special characters such as space, question mark, ampersand.