我在 shell 脚本中获得了一个带有 wget 的页面,但是 header 信息转到了标准输出,我如何将它重定向到一个文件?
#!/bin/sh
wget -q --server-response http://192.168.1.130/a.php > /tmp/ilan_detay.out
root@abc ./get.sh
HTTP/1.0 200 OK
X-Proxy: 130
Set-Cookie: language=en; path=/; domain=.abc.com
X-Generate-Time: 0,040604114532471
Content-type: text/html
Connection: close
Date: Mon, 17 Jan 2011 02:55:11 GMT
root@abc
最佳答案
header 信息必须转到 stderr
,因此您需要将其重定向到文件。为此,将 >
更改为 2>
关于bash - 重定向 wget header 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4709642/