Send the bc check to /dev/null

This commit is contained in:
Alex Epstein 2017-08-02 08:41:35 -04:00
parent d8980a0a9c
commit 9e06d7a0fd
2 changed files with 3 additions and 3 deletions

View File

@ -166,7 +166,7 @@ convertCurrency()
{
exchangeTo=$(echo "$exchangeTo" | tr '[:upper:]' '[:lower:]')
exchangeRate=$(httpGet "https://api.coinmarketcap.com/v1/ticker/$reqId/?convert=$exchangeTo" | grep -Eo "\"price_$exchangeTo\": \"[0-9 .]*" | sed s/"\"price_$exchangeTo\": \""//g) > /dev/null
if ! command -v bc; then
if ! command -v bc &>/dev/null; then
exchangeRate=$(echo $exchangeRate | grep -Eo "[0-9]*" )
exchangeAmount=$(( $exchangeRate * $amount ))
else

View File

@ -137,13 +137,13 @@ checkInternet()
convertCurrency()
{
exchangeRate=$(httpGet "http://api.fixer.io/latest?base=$base&symbols=$exchangeTo" | grep -Eo "[0-9]*[.][0-9]*") > /dev/null
if ! command -v bc; then
if ! command -v bc &>/dev/null; then
exchangeRate=$(echo $exchangeRate | grep -Eo "[0-9]*" )
exchangeAmount=$(( $exchangeRate * $amount ))
else
exchangeAmount=$( echo "$exchangeRate * $amount" | bc )
fi
cat <<EOF
=========================