Skip to content

Instantly share code, notes, and snippets.

@yappo
Created February 21, 2013 08:07
Show Gist options
  • Save yappo/5003089 to your computer and use it in GitHub Desktop.
Save yappo/5003089 to your computer and use it in GitHub Desktop.
#!/bin/sh
function httpstatus () {
result=`curl -kL http://www.studyinghttp.net/status_code 2> /dev/null | grep '<li><a href="#Code..."><code class="Status">...</code> ' | sed -e 's/<li><a href="#Code..."><code class="Status">//' -e 's/<\/code>//' -e 's/<\/a><\/li>//' | grep ^$1`
if [ "$result" = "" ]; then
curl -kL http://www.studyinghttp.net/status_code 2> /dev/null | grep '<li><a href="#Code..."><code class="Status">...</code> ' | sed -e 's/<li><a href="#Code..."><code class="Status">//' -e 's/<\/code>//' -e 's/<\/a><\/li>//' | grep $1
else
echo "$result"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment