Here is my full code:
#!/bin/bash
wget -O /tmp/crex24.txt --no-check-certificate "https://api.crex24.com/CryptoExchangeService/BotPublic/ReturnTicker?request=[NamePairs=BTC_LTC,BTC_ETH,BTC_XMR]"
echo "++++++++++++++++ CREX 24 ++++++++++++++++"
number_of_pairs=`cat /tmp/crex24.txt | grep PairId | wc -l`
count=1
while [ $count -le $number_of_pairs ]
do
pairname=`cat /tmp/crex24.txt | grep -e "PairName" | sed -n "${count}p" | cut -d: -f2 | tr -d '", ' | cut -c1-10`
highprice=`cat /tmp/crex24.txt | grep -e "HighPrice" | sed -n "${count}p" | cut -d: -f2 | tr -d '", ' | cut -c1-10`
lowprice=`cat /tmp/crex24.txt | grep -e "LowPrice" | sed -n "${count}p" | cut -d: -f2 | tr -d '", ' | cut -c1-10`
echo "$highprice $lowprice $pairname"
echo "$pairname $highprice $lowprice"
let "count++"
done
Output:
++++++++++++++++ CREX 24 ++++++++++++++++
0.01663970 0.01574956 BTC_LTC
0.01663970 0.01574956
0.07105730 0.06700000 BTC_ETH
0.07105730 0.06700000
0.03130300 0.02700000 BTC_XMR
0.03130300 0.02700000
My question is why wont $pairname echo out when in the beginning ? What am i doing wrong ?
Thanks.