Skip to content

Instantly share code, notes, and snippets.

@RockyRx

RockyRx/define Secret

Last active November 23, 2015 07:50
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 RockyRx/1fe12ee85074e361836a to your computer and use it in GitHub Desktop.
Save RockyRx/1fe12ee85074e361836a to your computer and use it in GitHub Desktop.
#!/bin/bash
#Filename: define.sh
#Desc: A script to fetch definitions from dictionaryapi.com
apikey=YOUR_API_KEY
if [ $# -ne 2 ];
then
echo -e "Usage: WORD DEFINITION_COUNT"
exit -1;
fi
curl --silent http://www.dictionaryapi.com/api/v1/references/learners/xml/$1?key=$apikey | \
grep -o \<dt\>.*\</dt\> | \
sed 's$</*[a-z]*>$$g' | \
head -n $2 | nl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment