diff options
author | Asa Venton <asav1410@gmail.com> | 2020-10-18 16:50:44 +0100 |
---|---|---|
committer | Asa Venton <asav1410@gmail.com> | 2020-10-18 16:50:44 +0100 |
commit | 252fc55b1065e0cef8bad2c798c3c40adcc6c2ad (patch) | |
tree | b41ec636c09b4f382229dd9ed38a4121dd65d3f3 | |
parent | 6c7a1a705cebf56d0b3a69e94cdb8cf2d3fc6182 (diff) |
Fix broken flags, fix broken etymology json filter. Rename variable for clarity.
-rwxr-xr-x | oeddefine.sh | 14 |
1 files 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 |