From 252fc55b1065e0cef8bad2c798c3c40adcc6c2ad Mon Sep 17 00:00:00 2001 From: Asa Venton Date: Sun, 18 Oct 2020 16:50:44 +0100 Subject: Fix broken flags, fix broken etymology json filter. Rename variable for clarity. --- oeddefine.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/oeddefine.sh b/oeddefine.sh index aa76bde..1c3ae8a 100755 --- a/oeddefine.sh +++ b/oeddefine.sh @@ -3,9 +3,9 @@ read word word=$(echo $word | tr '[:upper:]' '[:lower:]') appId= -key= +appKey= language=en-gb -OPTS='--silent -L -H "app_id: $appId" -H "app_key: $key"' +OPTS='--silent -L -H "app_id: $appId" -H "app_key: $appKey"' maxSynonyms=10 _getdata() { @@ -58,8 +58,8 @@ _define() { # Return etymology if available _etym() { _getdata - output=$(echo "${result}" | jq '.results[].lexicalEntries[0].Entries[0].etymologies[0]') - if [ -z "$output"]; then + output=$(echo "${result}" | jq '.results[].lexicalEntries[0].entries[0].etymologies[0]') + if [ -z "$output" ]; then echo "No etymology found." else echo $output @@ -88,14 +88,14 @@ _help() { exit 0 } -if [[ ${word} == "-h" ]] || [[ ${word} == "--help" ]] || [ -z $word ]; then +if [[ ${word} == "-h" ]] || [[ ${word} == "--help" ]] || [[ -z $word ]]; then _help elif [[ ${word} == "--source" ]] || [[ ${word} == "-s" ]]; then echo "https://www.blatech.co.uk/ars/oeddefine" exit 0 -elif [[ ${word} == *"-t"* ]]; then +elif [[ ${word} =~ "-t" ]]; then _thes -elif [[ ${word} == *"-e"* ]]; then +elif [[ ${word} =~ "-et" ]]; then _etym else _define -- cgit v1.2.3