我无法使用wget下载文件,但如果我将此链接添加到Safari,则会成功下载。这个问题的原因是什么?
Andreys-MacBook-Pro:currentFolder kleverigheid$ wget http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25.pl?file=gfs.t06z.pgrb2.0p25.f000&all_lev=on&all_var=on&subregion=&leftlon=22&rightlon=42&toplat=53&bottomlat=45&dir=/gfs.2015070506
[1] 70728
[2] 70729
[3] 70730
[4] 70731
[5] 70732
[6] 70733
[7] 70734
[2] Done all_lev=on
[3] Done all_var=on
[4] Done subregion=
[5] Done leftlon=22
[6]- Done rightlon=42
[7]+ Done toplat=53
Andreys-MacBook-Pro:currentFolder kleverigheid$ --2015-07-05 15:02:05-- http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25.pl?file=gfs.t06z.pgrb2.0p25.f000
Resolving nomads.ncep.noaa.gov... 140.90.101.62
Connecting to nomads.ncep.noaa.gov|140.90.101.62|:80... connected.
HTTP request sent, awaiting response... 404 data file not present
2015-07-05 15:02:06 ERROR 404: data file not present.
Andreys-MacBook-Pro:currentFolder kleverigheid$
答案 0 :(得分:0)
shell - 不是wget - 将&
解释为特殊字符,指示在后台运行程序。为避免这种情况,只需将整个网址放在引号中,如下所示:
$ wget 'http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25.pl?file=gfs.t06z.pgrb2.0p25.f000&all_lev=on&all_var=on&subregion=&leftlon=22&rightlon=42&toplat=53&bottomlat=45&dir=/gfs.2015070506'