#!/bin/bash
printf -v coin '%s' -1 # ergopad.sh sigrsv
price() {
# A function that pulls cryptocurrency price data from ergopad
# and formats it into a multi-currency banner for the console
curl -X 'GET' 'https://ergopad.io/api/asset/price/'"$1"'' \
-H 'accept: application/json' 2> /dev/null | # sends download data to /dev/null
sed 's/.*://' | # Removes everything before the price
sed 's/.$//' | # Removes back }
sed -re 's/([0-9]+\.[0-9]{5})[0-9]+/\1/g' | # Leaves five, removes extra decimals
sed 's/^/\$/' # Adds dollar sign to the front, returns
}
price=$(price $1)
ergo=$(price ergo)
ergopad=$(price ergopad)
# Checks to see if there was a command line variable and prints to console
if [[ -z $1 ]]; then
echo "ergo: ${ergo} | ergopad: ${ergopad}"
else
echo "${1}: ${price} | ergo: ${ergo} | ergopad: ${ergopad}"
fi