Microsoft
Software
Hardware
Network
Question : Curl: how to get httpcode in Bash
Hi experts,
I know that I can use
curl -o $WEBSITEID "$URL"
to retrieve data from a url, however how to check if the retrieval is successful or not? In other words, how to get the response code (such as "200", or "404")?
Thanks for your replies.
Answer : Curl: how to get httpcode in Bash
1:
status=$(curl -s --head "$URL" | awk '/HTTP/ {print $2})
Open in New Window
Select All
Random Solutions
Administrator account locked out every five minutes
Uninstalling CA's eTrust Antivirus silently
Server: Msg 170
Sort by only last digit in a column in excel
Delegate ability to add computers to domain but not delete
Download excel files from internet
What's The Difference Between Lotus Notes and Relational Database Management System (RDMS)?
How to create repeating pages in Word
SQL Server 2005 not accepting DB instance name that include port number for replication setup
password for isql