Last active
February 23, 2018 05:02
-
-
Save denmch/f7d9b8e0f01b2ab67ec633ccc9799f9f to your computer and use it in GitHub Desktop.
A shell function that looks up a word via the Wordnik API, grabs each definition via json, and cats out the results with line numbers
This file contains 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
# Define a word in the terminal via the Wordnik API with numbered output | |
function def() { | |
params="$@" | |
params_encoded=${params/ /%20} | |
curl --silent http://api.wordnik.com:80/v4/word.json/"$params_encoded"/definitions\?api_key\="$WORDNIK_KEY" \ | |
| json --array text \ | |
| cat -b | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment