linux中的cURL命令返回http响应代码

use*_*889 3 linux bash curl http

我想在linux OS中使用cURL命令返回结果只是http响应代码,如果它是okey,则为"200"

我正在使用该命令:

curl -I -L domain.com
Run Code Online (Sandbox Code Playgroud)

但是这对我来说是一个像这样的全文

HTTP/1.1 **200** OK
Date: Thu, 27 Feb 2014 19:32:45 GMT
Server: Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.4.19
X-Powered-By: PHP/5.4.19
Set-Cookie: PHPSESSID=bb8aabf4a5419dbd20d56b285199f865; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding,User-Agent
Content-Type: text/html
Run Code Online (Sandbox Code Playgroud)

所以,我只需要响应代码而不是全文

问候

Sab*_*san 8

curl -s -o out.html -w '%{http_code}' http://www.example.com
Run Code Online (Sandbox Code Playgroud)