plugfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

crypto (417B)


      1 #!/bin/bash
      2 # Nicholas Farrow 2020
      3 crypto_rate () {
      4 	if [ "$1" == "BTC" ]; then ln=2; else ln=1; fi
      5 	echo "$(curl -s rate.sx | grep $1 | sed -n ${ln}p | grep -Eo "[0-9]*\.[0-9]*" | head -1)"
      6 }
      7 
      8 BTC=$(crypto_rate "BTC")
      9 ETH=$(crypto_rate "ETH")
     10 RATIO=$(bc <<< "scale=4;$ETH/$BTC")
     11 
     12 printf "BTC:%0.0f " $BTC
     13 #printf "ETH:%0.0f " $ETH
     14 #printf "E/B:%0.3f" $RATIO
     15 printf "\n"
     16 #echo -e "BTC:$BTC ETH:$ETH ETH/BTC:0$RATIO"
     17