Skip to content

Instantly share code, notes, and snippets.

@ceme
Created March 5, 2017 19:13
Show Gist options
  • Save ceme/58ba3c33354470cb762edec939132119 to your computer and use it in GitHub Desktop.
Save ceme/58ba3c33354470cb762edec939132119 to your computer and use it in GitHub Desktop.
Chatty curl to output file with cheap argument host validation, no usefull usage instructions, and hardcoded output file name, pretty rudimentery code.
#! /bin/sh
function check {
if [ $? -ne 0 ] ; then
echo "Error occurred getting URL $1;"
if [ $? -eq 6 ]; then
echo "Unable to reslove host"
fi
if [ $? -eq 7 ]; then
echo "Unable to contact host"
fi
exit 1
fi
}
curl -s -o "check_out001.txt" $1
check;
echo 'got it'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment