mirror of
https://github.com/alexanderepstein/Bash-Snippets
synced 2018-11-08 02:59:35 +01:00
Send the bc check to /dev/null
This commit is contained in:
parent
d8980a0a9c
commit
9e06d7a0fd
@ -166,7 +166,7 @@ convertCurrency()
|
|||||||
{
|
{
|
||||||
exchangeTo=$(echo "$exchangeTo" | tr '[:upper:]' '[:lower:]')
|
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
|
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]*" )
|
exchangeRate=$(echo $exchangeRate | grep -Eo "[0-9]*" )
|
||||||
exchangeAmount=$(( $exchangeRate * $amount ))
|
exchangeAmount=$(( $exchangeRate * $amount ))
|
||||||
else
|
else
|
||||||
|
@ -137,7 +137,7 @@ checkInternet()
|
|||||||
convertCurrency()
|
convertCurrency()
|
||||||
{
|
{
|
||||||
exchangeRate=$(httpGet "http://api.fixer.io/latest?base=$base&symbols=$exchangeTo" | grep -Eo "[0-9]*[.][0-9]*") > /dev/null
|
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]*" )
|
exchangeRate=$(echo $exchangeRate | grep -Eo "[0-9]*" )
|
||||||
exchangeAmount=$(( $exchangeRate * $amount ))
|
exchangeAmount=$(( $exchangeRate * $amount ))
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user