在我的 Centos 6.2 上,我有这个 bash 脚本:
[le_me]$ cat get.nb
#! /bin/bash
/usr/bin/wget -O /var/www/html/leFile.xml http://www.leSite.com/leFeed.xml
[le_me]$ source getFeeds.nb
: command not found
--2012-06-22 12:46:18-- http://www.leSite.com/leFeed.xml%0D
Resolving www.leSite.com... 1.2.3.4
Connecting to www.leSite.com|1.2.3.4|:80... connected.
HTTP request sent, awaiting response... 406 Not Acceptable
2012-06-22 12:46:18 ERROR 406: Not Acceptable.
对我来说奇怪的是,当我运行这个命令时
/usr/bin/wget -O /var/www/html/leFile.xml http://www.leSite.com/leFeed.xml
在控制台中,一切正常,文件下载没有问题。
我对它进行了谷歌搜索,我注意到这%0D
应该是一个回车字符,我尝试在链接之后放置另一个空格,如下所示:http://www.leSite.com/leFeed.xml[spaceChar]
我下载了文件,但我担心命令找不到输出并最终获取回车(我知道这是因为空间,但现在至少我下载了我最初想要的文件):
[le_me]$ source get.nb
: command not found
--2012-06-22 13:05:26-- http://www.leSite.com/leFeed.xml
Resolving www.leSite.com... 2.17.249.51
Connecting to www.leSite.com|2.17.249.51|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 35671435 (34M) [application/atom+xml]
Saving to: “/var/www/html/leFile.xml”
100%[=================================>] 35,671,435 37.2M/s in 0.9s
2012-06-22 13:05:27 (37.2 MB/s) - “/var/www/html/leFile.xml” saved [35671435/35671435]
--2012-06-22 13:05:27-- http://%0D/
Resolving \r... failed: Name or service not known.
wget: unable to resolve host address “\r”
FINISHED --2012-06-22 13:05:27--
Downloaded: 1 files, 34M in 0.9s (37.2 MB/s)
任何人都可以对此有所了解吗?