Buy Moto series phones: Moto E, Moto G, Moto X or Other phones
Buy eBooks from Flipkart
-----------------------------------------------
We can use below command to get http response code of a URL from bash script.
status_code=$(curl --write-out "\n%{http_code}\n" --silent --output /dev/null --insecure https://www.google.co.in/)
silent - to stop progress information in output
output - we are re-directing normal output to null device
write-out - whatever things we needed can be given here. Here we are printing http status code. It will be printed after completion, i.e., after printing all output.
insecure - this allows connections to SSL sites without certs
References: http://stackoverflow.com/a/2220646/324900
Monday, May 26, 2014
To get http status code from curl call
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment