开发者

redirect wget header output

开发者 https://www.devze.com 2023-02-04 20:14 出处:网络
i\'m getting a page with wget in a shell script, but header information going to stdout, how can i redirect 开发者_开发问答it to a file?

i'm getting a page with wget in a shell script, but header information going to stdout, how can i redirect 开发者_开发问答it to a file?

#!/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


The header info must be going to stderr so you'll need to redirect that to a file. To do that change the > to 2>


To get only the server response in a file you can do:

wget -q --server-response http://www.stackoverflow.com >& response.txt

You can read more about UNIX output redirection here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号