Script to get the HTTP status code of a list of urls?

前端 未结 8 868
无人及你
无人及你 2020-11-30 17:17

I have a list of URLS that I need to check, to see if they still work or not. I would like to write a bash script that does that for me.

I only need the returned HTT

8条回答
  •  -上瘾入骨i
    2020-11-30 17:43

    Use curl to fetch the HTTP-header only (not the whole file) and parse it:

    $ curl -I  --stderr /dev/null http://www.google.co.uk/index.html | head -1 | cut -d' ' -f2
    200
    

提交回复
热议问题