Advertisement
Guest User

Coinmarketcap.com api crypto info - bash script

a guest
Apr 25th, 2018
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. #!/bin/bash
  2. #By Jean-Baptiste Fleury <jean-baptiste.fleury@epitech.eu>
  3.  
  4. if [ -z $1 ]
  5. then
  6.     echo "USAGE: ./crypto.sh [SYMBOL]"
  7.     exit
  8. fi
  9.  
  10. curl https://api.coinmarketcap.com/v1/ticker/?convert=EUR -s > /tmp/cmc_api.txt
  11. line=` cat /tmp/cmc_api.txt | grep -n "\"symbol\": \"$1\"" | cut -d: -f1`
  12.  
  13. cat /tmp/cmc_api.txt | tail -n +$line | head -n +16 | tr -d \" | tr -d ,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement