From fec42a02911233da1286043e3babdcf5354d464c Mon Sep 17 00:00:00 2001 From: Asa Venton Date: Fri, 30 Oct 2020 09:41:22 +0000 Subject: Simplify prefixing output with the word of the day. Adjust comment. --- oedquery.sh | 10 +++------- 1 file 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 } -- cgit v1.2.3