Created
September 12, 2021 07:45
-
-
Save Mr-Destructive/78f03a61792ac95fa0c882d84b106c85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function strip_html(){ | |
grep -oP '(?<=<span class="no-wrap" data-price-btc).*?(?=</span>)' $output >temp.txt | |
sed -i 's/[^>]*>//g' temp.txt >$output | |
sed -ni '1p' temp.txt >$output | |
cp temp.txt $output | |
rm temp.txt | |
} | |
function print(){ | |
while read price | |
do | |
val=$price | |
done <$output | |
echo "The price of $coin is = $val" | |
} | |
read -p "enter the coin code : " coin | |
url='https://www.coingecko.com/en/coins/'$coin'' | |
output=price.txt | |
touch $output temp.txt | |
curl -o $output $url | |
strip_html | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment