bash - 重定向 wget header 输出

标签 bash redirect

我在 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/

相关文章:

linux - Bash:如何拖尾然后复制多个文件(例如使用 xargs)?

.htaccess - 如何在 301 重定向中使用 RewriteRule URL

php - 将子域重定向到其子文件夹,Safari 显示尝试打开时发生太多重定向

python - 如果 session 因无事件而过期,则注销并重定向到登录页面

bash - 使用wget抓取网站并限制抓取链接总数

bash ffmpeg 使用输入文件名作为输出视频文件名

c - 没有 "export"的挡泥板

apache - 使用 https 将公园域重定向到 http

node.js - CORS 和 HTTPS 重定向的 Access-Control-Allow-Origin 问题(IIS/IISNode/NodeJS)

linux - 将命令输出保存在保留换行符的字符串变量中