From 40df20fb858fe6bddb8ec51044c8d3c34723ea6b Mon Sep 17 00:00:00 2001 From: Alex Epstein Date: Fri, 19 Oct 2018 18:35:35 -0700 Subject: [PATCH] Adding new rates.sx feature to cryptocurrency --- cryptocurrency/cryptocurrency | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cryptocurrency/cryptocurrency b/cryptocurrency/cryptocurrency index dc4695b..89beae0 100755 --- a/cryptocurrency/cryptocurrency +++ b/cryptocurrency/cryptocurrency @@ -254,11 +254,14 @@ EOF -while getopts "of:uvh" opt; do +while getopts "c:of:uvh" opt; do case "$opt" in \?) echo "Invalid option: -$OPTARG" >&2 exit 1 ;; + c) + currency=$OPTARG + ;; h) usage exit 0 ;; @@ -305,8 +308,13 @@ fi getConfiguredClient || exit 1 checkInternet || exit 1 +link="rate.sx" if [[ $fiat =~ [a-zA-Z] ]]; then - httpGet $fiat.rate.sx -else - httpGet rate.sx + link="$fiat.$link" fi + +if [[ $currency =~ [a-zA-Z] ]]; then + link="$link/$currency" +fi + +httpGet $link