diff options
-rwxr-xr-x | oedwordday.sh | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/oedwordday.sh b/oedwordday.sh deleted file mode 100755 index d54d403..0000000 --- a/oedwordday.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -word=$( curl --silent https://www.lexico.com/ | hxnormalize -x | hxselect -i "a.linkword" | grep -o '>.*<' | sed 's/[><]//g') -appId= -key= -language=en-gb -OPTS='--silent -L -H "app_id: $appId" -H "app_key: $key"' - -entriesUrl=https://od-api.oxforddictionaries.com/api/v2/entries/$language/$word - -# get definition of headword -result=$(eval curl $OPTS $entriesUrl) -ret=$? -if [ "$ret" -ne 0 ] -then - echo "cURL error $ret when fetching." - exit -fi - -# Get first definition from received json -definition=$(echo $result | jq '.results[].lexicalEntries[].entries[0].senses[0].definitions[]') - -# Get lexical category for first definition -lexicalCategory=$(echo $result | jq '.results[].lexicalEntries[0].lexicalCategory.text') - -# Remove surrounding quotes -definition=$(echo "${definition:1: -1}") -lexicalCategory=$(echo "${lexicalCategory:1: -1}") - -# Return word, lexical category and first definition. -echo ${word^}" - "$lexicalCategory" - "$definition |