summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsa Venton <asav1410@gmail.com>2020-10-30 09:41:22 +0000
committerAsa Venton <asav1410@gmail.com>2020-10-30 09:41:22 +0000
commitfec42a02911233da1286043e3babdcf5354d464c (patch)
tree2e18cf5f52304d851ba0e46ec3eb7d7e8ef7ac01
parent56b003453a5cdea3dc822c6948ca05295654c5fe (diff)
Simplify prefixing output with the word of the day. Adjust comment.
-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
}