From 54a24859f6881643f8508f5167933acf9e9f7352 Mon Sep 17 00:00:00 2001 From: Vincent Composieux Date: Sun, 3 Dec 2017 15:36:40 +0100 Subject: [PATCH] Added a bitcoinalert function to be notified on OS X when a value is reached --- .functions | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.functions b/.functions index b45b291..368649c 100644 --- a/.functions +++ b/.functions @@ -7,6 +7,17 @@ function b64decode() { echo -n "$*" | base64 --decode } +# Usage: bitcoinalert 9800 +function bitcoinalert() { + while true; do + value=$(bitcoin) + + if (( $(echo "$value > $1" | bc -l) )); then + osascript -e "display notification "$value" with title \"Bitcoin alert\" subtitle \"Current value:\""; + fi + done +} + # Preview CSVs function csvpreview() { sed 's/,,/, ,/g;s/,,/, ,/g' "$@" | column -s, -t | less -#2 -N -S @@ -195,4 +206,3 @@ transfer() { echo "\n"; rm -f $tmpfile; } -