Skip to content

Instantly share code, notes, and snippets.

@nhocki
Last active February 11, 2017 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nhocki/00d9659a14c837160d3c12e6e1bf3cc9 to your computer and use it in GitHub Desktop.
Save nhocki/00d9659a14c837160d3c12e6e1bf3cc9 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
CMD=${1:-false}
URL=${2:-example.com}
if [ $CMD = false ]; then
echo "usage: " $0 "command [url:example.com]"
exit 1
fi
{ time $CMD > cmd.out 2> cmd.err ; } 2> time.out
if [ $? = 0 ];
then
echo "+ time:"
cat time.out
echo
echo "+ curling baby:"
curl $URL
else
echo "+ Error:"
cat cmd.err
fi
# { time tree /var > cmd.out 2> cmd.err ; } 2> time.out; if [ $? = 0 ]; then cat time.out; curl example.com; else cat cmd.err; fi `
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment