summaryrefslogtreecommitdiff
path: root/local
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-03-06 22:32:47 +1300
committerDavid Phillips <david@sighup.nz>2017-03-06 22:34:53 +1300
commit9c5844734a670a2003216fb96ab5343a10522ebf (patch)
treed101b2b1f4c9545300ebd1cdd3ae3fc74bb21113 /local
parent05ed95b9221dece8cae9bd6021d02375c26ee491 (diff)
downloaddotfiles-9c5844734a670a2003216fb96ab5343a10522ebf.tar.xz
Report error on grab spot
Diffstat (limited to 'local')
-rwxr-xr-xlocal/bin/grab-spot6
1 files changed, 5 insertions, 1 deletions
diff --git a/local/bin/grab-spot b/local/bin/grab-spot
index 0450c8e..b55b461 100755
--- a/local/bin/grab-spot
+++ b/local/bin/grab-spot
@@ -11,5 +11,9 @@ fi
# Only bother downloading if it's more than 3 hours old
if [ $(find ~/.cache/"$1$2" -mmin +180) ] ; then
rate=$(curl "http://rate-exchange-1.appspot.com/currency?from=$1&to=$2" | jshon -e rate)
- echo "$1$2: $rate" > ~/.cache/"$1$2"
+ if [ $? -ne 0 ] ; then
+ logger "$0: curl error"
+ exit
+ fi
+ printf "$1$2: %.4f" $rate > ~/.cache/"$1$2"
fi