Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 故障保护wget html脚本?(当用户使用~\.wgetrc时)_Linux_Bash_Wget - Fatal编程技术网

Linux 故障保护wget html脚本?(当用户使用~\.wgetrc时)

Linux 故障保护wget html脚本?(当用户使用~\.wgetrc时),linux,bash,wget,Linux,Bash,Wget,我刚刚遇到了一个问题。这是关于alienbob用来检查adobe.com上最新Adobeflash版本的脚本中的一段代码片段: # Determine the latest version by checking the web page: VERSION=${VERSION:-"$(wget -O - http://www.adobe.com/software/flash/about/ 2>/dev/null | sed -n "/Firefox - NPAPI/{N;p}" | tr

我刚刚遇到了一个问题。这是关于alienbob用来检查adobe.com上最新Adobeflash版本的脚本中的一段代码片段:

# Determine the latest version by checking the web page:
VERSION=${VERSION:-"$(wget -O - http://www.adobe.com/software/flash/about/ 2>/dev/null | sed -n "/Firefox - NPAPI/{N;p}" | tr -d ' '| tail -1 | tr '<>' '  ' | cut -f3 -d ' ')"}
echo "Latest version = "$VERSION
这意味着,当我使用wget下载一个html文件时,它会将该文件作为gipped html下载

现在我想知道,有没有一个技巧可以让像alienbob这样的脚本在这样的用户设置上继续工作,或者用户用这个设置搞乱了自己的系统,并且必须自己找出脚本出现故障的原因

(在我的例子中,我可以删除
header=Accept Encoding
行,一切都正常工作,因为在使用wget时,通常不希望html文件被压缩)

使用

wget --header=Accept-Encoding:identity -O - ....
因为标题选项将优先于同名的.wgetrc选项

也许目标页面已重新设计,这是wget部分,现在适用于我:

wget --header=Accept-Encoding:identity -O - http://www.adobe.com/software/flash/about/ 2>/dev/null | fgrep -m 1 -A 2 "Firefox - NPAPI" | tail -1 | sed s/\</\>/g | cut -d\> -f3
wget--header=接受编码:标识-O-http://www.adobe.com/software/flash/about/ 2> /dev/null | fgrep-m1-a2“Firefox-NPAPI”| tail-1 | sed s/\/g | cut-d\>-f3
wget --header=Accept-Encoding:identity -O - http://www.adobe.com/software/flash/about/ 2>/dev/null | fgrep -m 1 -A 2 "Firefox - NPAPI" | tail -1 | sed s/\</\>/g | cut -d\> -f3