From 17269631467585e7f016bbd481b65fb9aef74052 Mon Sep 17 00:00:00 2001 From: Aidan Hobson Sayers Date: Fri, 5 Apr 2013 14:44:28 +0100 Subject: [PATCH] Bashism crusade --- JSON.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/JSON.sh b/JSON.sh index 162ff14..8325167 100755 --- a/JSON.sh +++ b/JSON.sh @@ -22,7 +22,8 @@ usage() { parse_options() { set -- "$@" - while true + local ARGN=$# + while [ $ARGN -ne 0 ] do case $1 in -h) usage @@ -42,6 +43,7 @@ parse_options() { ;; esac shift 1 || break + ARGN=$((ARGN-1)) done } @@ -129,10 +131,10 @@ parse_value () { ''|[!0-9]) throw "EXPECTED value GOT ${token:-EOF}" ;; *) value=$token isleaf=1 - [ "$value" == '""' ] && isempty=1 + [ "$value" = '""' ] && isempty=1 ;; esac - [ "$value" == '' ] && return + [ "$value" = '' ] && return [ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 0 ] && print=1 [ "$LEAFONLY" -eq 1 ] && [ "$isleaf" -eq 1 ] && [ $PRUNE -eq 0 ] && print=1 [ "$LEAFONLY" -eq 0 ] && [ "$PRUNE" -eq 1 ] && [ "$isempty" -eq 0 ] && print=1