From 69d464818c7a6e599771fe67d407c163c8a7a0c4 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 14 Sep 2021 13:37:00 +0530 Subject: config changes sync --- scripts/rate-sx.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 scripts/rate-sx.sh (limited to 'scripts/rate-sx.sh') diff --git a/scripts/rate-sx.sh b/scripts/rate-sx.sh new file mode 100755 index 0000000..baec270 --- /dev/null +++ b/scripts/rate-sx.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +rate_sx() { + [[ ! -z "$2" ]] \ + && curl $2.rate.sx/$1 \ + || curl rate.sx/$1; +} + +get_1() { cut -d' ' -f1; } +get_2() { cut -d' ' -f2; } + +help() { + echo " +::: Rate.sx repl ::: + btc: get graph for btc in usd + btc inr: get graph for btc in inr + 1btc inr: print the value of 1btc in inr + q: quit +"; +} + +help; + +while true; do + while IFS="" read -r -e -d $'\n' -p 'rate.sx $ ' command; do + case "$(echo $command | get_1)" in + q) exit 0 ;; + *) rate_sx $command ;; + esac; + done; +done; + -- cgit v1.3.1