Skip to content

Instantly share code, notes, and snippets.

@CameronBanga
Created May 3, 2016 17:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CameronBanga/bfb957606c2b3fbc3da332277739c9ee to your computer and use it in GitHub Desktop.
Save CameronBanga/bfb957606c2b3fbc3da332277739c9ee to your computer and use it in GitHub Desktop.
A quick and bad bash script to help Harry log an API.
#!/bin/bash
## date format to log the time of the pull##
NOW=$(date +"%Y-%m-%d %H:%M:%S")
## change this to wherever you want your log stored
echo ""API pull at "$NOW" >> ~/Documents/API.txt
## update your curl here, obviously use same file
curl -X "GET" "http://www.google.com" >> ~/Documents/API.txt
## this is a lame way to create line breaks. having issue with echo and zsh, so used printf like a newb
printf '\n\n' >> ~/Documents/API.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment