summaryrefslogtreecommitdiff
path: root/oedquery.sh
diff options
context:
space:
mode:
Diffstat (limited to 'oedquery.sh')
-rwxr-xr-xoedquery.sh22
1 files changed, 18 insertions, 4 deletions
diff --git a/oedquery.sh b/oedquery.sh
index 043467f..12811c8 100755
--- a/oedquery.sh
+++ b/oedquery.sh
@@ -2,11 +2,25 @@
read word
word=$(echo $word | tr '[:upper:]' '[:lower:]')
-appId=
-appKey=
-language=en-gb
+# Create array of variable to read from config file
+config=(
+ appId
+ appKey
+ language
+ maxSynonyms
+)
+# curl options
OPTS='--silent -L -H "app_id: $appId" -H "app_key: $appKey"'
-maxSynonyms=10
+
+while read line
+do
+ # If config file variable doesn't match variable in config array then ignore it.
+ if [[ " ${config[@]} " =~ " $(echo "$line" | cut -d '=' -f 1) " ]]
+ then
+ # Declare variables
+ eval $(echo "$line" | cut -d '=' -f 1)=$(echo "$line" | cut -d '=' -f 2-)
+fi
+done < oedquery.conf
# function to provide data to a for loop
_jq() {