aboutsummaryrefslogtreecommitdiff
path: root/scripts/rate-sx.sh
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2021-09-14 13:37:00 +0530
committerAkshay Nair <phenax5@gmail.com>2021-09-14 13:37:00 +0530
commit69d464818c7a6e599771fe67d407c163c8a7a0c4 (patch)
treeb361000d0cbfa4609cc66a8a1c707e63d859990d /scripts/rate-sx.sh
parent4d89e28f26075ecf3a8d132fe5177eecef99b565 (diff)
downloadnixos-config-69d464818c7a6e599771fe67d407c163c8a7a0c4.tar.gz
nixos-config-69d464818c7a6e599771fe67d407c163c8a7a0c4.zip
config changes sync
Diffstat (limited to 'scripts/rate-sx.sh')
-rwxr-xr-xscripts/rate-sx.sh32
1 files changed, 32 insertions, 0 deletions
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;
+