summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xoedquery.sh10
1 files changed, 3 insertions, 7 deletions
diff --git a/oedquery.sh b/oedquery.sh
index 4d6f430..6ab283c 100755
--- a/oedquery.sh
+++ b/oedquery.sh
@@ -28,7 +28,7 @@ _curl() {
((curlCount=curlCount+1))
}
-# function to provide data to a for loop
+# function to provide data inside a for loop
_jq() {
echo ${json} | base64 --decode | jq -r ${1}
}
@@ -59,11 +59,6 @@ _getdata() {
# Return definition for the first sense of each lexical entry and create output string
_define() {
_getdata
- # If requesting word of the day then output the word too
- if [[ $wod == true ]]
- then
- output="$output $word - "
- fi
for json in $(echo "${result}" | jq -r '.results[].lexicalEntries[] | @base64')
do
output="$output $(_jq '.lexicalCategory.text'): "
@@ -145,11 +140,12 @@ _audio() {
# Return first defintion with lexical category for Lexico's word of the day.
_wod() {
- wod=true
# Get word from lexico
lexicoUrl="https://www.lexico.com/"
_curl $lexicoUrl
word=$(echo $result | hxnormalize -x | hxselect -i "a.linkword" | grep -o '>.*<' | sed 's/[><]//g')
+ # Add the word of the day to the output.
+ output="$output $word - "
_define
}