From 48683f9ebcaab05d04ecbc64d57f7481ed2b4a47 Mon Sep 17 00:00:00 2001 From: Taleh Zaliyev Date: Mon, 31 Jul 2017 19:11:02 +0300 Subject: [PATCH] Stylistic changes to currency (#110) --- currency/currency | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/currency/currency b/currency/currency index 546c701..0aeb63e 100755 --- a/currency/currency +++ b/currency/currency @@ -5,6 +5,10 @@ base="" exchangeTo="" currentVersion="1.16.2" configuredClient="" +currencyCodes=(AUD BGN BRL CAD CHF CNY CZK DKK + EUR GBP HKD HRK HUF IDR ILS INR + JPY KRW MXN MYR NOK NZD PHP PLN + RON RUB SEK SGD THB TRY USD ZAR) ## This function determines which http get tool the system has installed and returns an error if there isnt one getConfiguredClient() @@ -33,16 +37,10 @@ httpGet() checkValidCurrency() { - if [[ $1 != "AUD" && $1 != "BGN" && $1 != "BRL" \ - && $1 != "CAD" && $1 != "CHF" && $1 != "CNY" && $1 != "CZK" && $1 != "DKK" \ - && $1 != "EUR" && $1 != "GBP" && $1 != "HKD" && $1 != "HRK" && $1 != "HUF" \ - && $1 != "IDR" && $1 != "ILS" && $1 != "INR" && $1 != "JPY" && $1 != "KRW" \ - && $1 != "MXN" && $1 != "MYR" && $1 != "NOK" && $1 != "NZD" && $1 != "PHP" \ - && $1 != "PLN" && $1 != "RON" && $1 != "RUB" && $1 != "SEK" && $1 != "SGD" \ - && $1 != "THB" && $1 != "TRY" && $1 != "USD" && $1 != "ZAR" ]]; then - echo "1" - else + if [[ "${currencyCodes[*]}" == *"$(echo "${@}" | tr -d '[:space:]')"* ]]; then echo "0" + else + echo "1" fi }