Skip to content

Instantly share code, notes, and snippets.



Forked from hrwgc/
Last active Aug 29, 2015
What would you like to do?
# simple function to check http response code before downloading a remote file
# example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment