From 95d1215ddd1f2db0bf94d4abc85d70235bf74624 Mon Sep 17 00:00:00 2001 From: manasshinde1877-cyber Date: Sun, 12 Apr 2026 21:13:52 +0530 Subject: [PATCH] Add logic to print price of Crypto Coin --- scripts/crypto-price | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/crypto-price b/scripts/crypto-price index 2aa9a16..41fd61c 100644 --- a/scripts/crypto-price +++ b/scripts/crypto-price @@ -12,6 +12,10 @@ API_URL="https://api.binance.com/api/v3/ticker/price?symbol=${SYMBOL}" echo "Fetching price for $COIN..." +price=$(curl -s ${API_URL} | awk -F'"price":"' '{print $2}' | cut -d'"' -f1 ) + +echo -n "Current price of $COIN is: $" +echo "${price}" # TODO: Use `curl -s` to fetch the JSON from $API_URL. # The JSON looks similar to: {"symbol":"BTCUSDT","price":"63000.00000000"} # Use `grep`, `sed`, `awk`, or `jq` (if installed) to extract just the exact price number.