wget to download image, link get truncated

妖精的绣舞 提交于 2019-12-25 02:22:34

问题


I have an IP camera and the link below takes a snap shot and show you the picture in your broswer:

http://192.168.5.10:81/snapshot.cgi?user=admin&pwd=888888

I am trying to write a script, using wget to download a snap shot to my local repeatably after a certain period. However, when i use

wget -m -p -k http://192.168.5.10:81/snapshot.cgi?user=admin&pwd=888888

I get the following respond:

 => `192.168.5.10:81/snapshot.cgi?user=admin'
Connecting to 192.168.5.10:81... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Connecting to 192.168.5.10:81... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.

The password part got truncated somehow, that is why i get 401 unauthorized problem. I think it is an easy problem to solve, but I am new to linux, any sugguestions how to fix this?

Thanks in advance


回答1:


You must enclose the URL in double quotes to prevent the ampersand & from being interpreted by the shell. I.e.

wget -m -p -k "http://192.168.5.10:81/snapshot.cgi?user=admin&pwd=888888"


来源:https://stackoverflow.com/questions/20955748/wget-to-download-image-link-get-truncated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!