Created
March 14, 2016 21:59
-
-
Save tlrobinson/e362b8397d1042997fd4 to your computer and use it in GitHub Desktop.
Command-line Giphy using iTerm2's imgcat (also requires curl and jq)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
tag="$(echo "$*" | sed 's/ /+/')" | |
random_api_url="http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=$tag" | |
gif_url="$(curl "$random_api_url" 2> /dev/null | jq '.data.image_url' -r)" | |
curl "$gif_url" 2> /dev/null | imgcat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For some reason I get
imgcat: command not found
but you can clearly see it's installed and working if I call it directly from the command line. I tried both bash and zsh. Any ideas? Thanks!