commit 850275f2201feecd687c825408cec4508633b78d parent e4be295cde904d3b8616d1bc31a921d1cf619eee Author: Wim Dupont <wim@wimdupont.com> Date: Fri, 8 Apr 2022 22:20:10 +0200 fix coin script Diffstat:
M | bin/coin | | | 7 | ++++--- |
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/bin/coin b/bin/coin @@ -23,7 +23,6 @@ while getopts ":hf:" arg; do done shift $((OPTIND-1)) -currencies=$@ # function to join arguments with the first one being the separator @@ -35,9 +34,11 @@ joinByString() { printf "%s" "$first" "${@/#/$separator}" } -# turns script arguments into api currency params +# turns script arguments into api currency params if not empty -currencyParam=$(joinByString '%2C' "${currencies}") +if [[ ! -z "${@// }" ]] ; then + currencyParam=$(joinByString ',' "$@") +fi # grab data from coinggecko api