Skip to content

Instantly share code, notes, and snippets.

@adamdehaven
Last active April 27, 2016 19:46
Show Gist options
  • Save adamdehaven/0b3ab7ade9654067075190ee515fc0c8 to your computer and use it in GitHub Desktop.
Save adamdehaven/0b3ab7ade9654067075190ee515fc0c8 to your computer and use it in GitHub Desktop.
Bash/Terminal to return the HTTP status code of a URL via cURL. Includes following redirects to final URL
#!/bin/bash
status=$(curl $1 -s -L -I -o /dev/null -w '%{http_code}')
echo $status
### Run
# $ bash http-status.sh http://google.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment