From d4c5c1c082aaaa75b87268223dcf2653b7b5a9a5 Mon Sep 17 00:00:00 2001 From: Asa Venton Date: Sun, 20 Oct 2019 13:59:47 +0100 Subject: Fix trailing comma on result, add TODOs --- livetimes.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/livetimes.sh b/livetimes.sh index 6dfcfb5..9c9d7bd 100755 --- a/livetimes.sh +++ b/livetimes.sh @@ -8,9 +8,9 @@ _jq() { echo ${json} | base64 --decode | jq -r ${1} } +# TODO: efficiency of _liveresult? _liveresult() { livetimes=$(curl --silent https://admin.libertybus.je/api/v1/soj/stop_updates/${stop}) - # doesn't work without encoding in base64 (why?) result="$result Dest: " for json in $(echo "${livetimes}" | jq -r '.[] | @base64'); do result="$result $(_jq '.destination'), " @@ -24,7 +24,7 @@ _liveresult() { result="$result | ETAs: " for json in $(echo "${livetimes}" | jq -r '.[] | @base64'); do result="$result $(_jq '.eta'), " - result=$(echo $result | sed 's/, $//') + result=$(echo $result | sed 's/,$//') done echo -e $result exit 0 -- cgit v1.2.3