如下,请忽略状态码,我自己设置的403,主要看curl的格式,没用grep的时候结果正常,用grep之后怎么会有“% Total % Received % Xferd Average Speed Time Time Time Current” 这些内容?
[root@haha ~]#
[root@haha ~]# curl -I 127.0.0.1:80
HTTP/1.1 403 Forbidden
Date: Mon, 21 Mar 2016 12:13:53 GMT
Server: Apache/2.2.31 (Unix) PHP/5.6.16
Content-Type: text/html; charset=iso-8859-1
[root@haha ~]#
[root@haha ~]#
[root@haha ~]# curl -I 127.0.0.1:80|grep HTTP
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
HTTP/1.1 403 Forbidden
[root@haha ~]#
[root@haha ~]#
curl 中 -s 表示--silent静音模式。不输出任何东西
[root@aliyun-63 sd]# curl -I -s www.baidu.com | grep HTTP
HTTP/1.1 200 OK
[root@aliyun-63 sd]#