Bitcoin price output using a terminal on Linux
It is very easy to display the current Bitcoin price using Linux.
There are many ways to do this.
One of the ways is using curl.
Just use this command to get information about Bitcoin.
This is another way to find out the current price of bitcoin.
curl -s https://api-pub.bitfinex.com/v2/ticker/tBTCUSD | awk -F',' '{print "BTC\/USD: " $7}'
BTC/USD: 42642
A very useful one-line program.
Only what is needed is output, and no more.
Another example is a very long one–line sentence.
The same information is displayed here in US dollars.
It's been a while and probably can be improved, but it really works.
curl -s https://goldprice.org/cryptocurrency-price | grep -e 'views-field views-field-field-crypto-price-1 views-align-right' | awk 'NR==2 {print substr( $0, -1, length($0)-6 )}' | sed 's/<[^>]*>//g' | awk '{$1=$1};1'
$42,799.00
In fact, the output formatted this way is much better.
#!/bin/sh
curl -s https://goldprice.org/cryptocurrency-price | \
grep -e 'views-field views-field-field-crypto-price-1 views-align-right' \
| awk 'NR==2 {print substr( $0, -1, length($0)-6 )}' | sed 's/<[^>]*>//g' \
| awk '{$1=$1};1'
But it works fine.
Just call it bitcoin.sh and make it executable so that it works.
chmod +x bitcoin.sh