Skip to content

Commit

Permalink
Remove most bashisms from main script
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanhs committed Mar 12, 2013
1 parent 680fa94 commit b974624
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions JSON.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ parse_array () {
while :
do
parse_value "$1" "$index"
let index=$index+1
index=$((index+1))
ary="$ary""$value"
read -r token
case "$token" in
Expand Down Expand Up @@ -74,7 +74,7 @@ parse_object () {
done
;;
esac
[[ $BRIEF -ne 1 ]] && value=`printf '{%s}' "$obj"`
[ $BRIEF -ne 1 ] && value=`printf '{%s}' "$obj"`
}

parse_value () {
Expand All @@ -86,7 +86,7 @@ parse_value () {
''|[^0-9]) throw "EXPECTED value GOT ${token:-EOF}" ;;
*) value=$token ;;
esac
[[ ! ($BRIEF -eq 1 && ( -z $jpath || $value == '""' ) ) ]] \
! ([ $BRIEF -eq 1 ] && ([ -z $jpath ] || [ $value = '""' ])) \
&& printf "[%s]\t%s\n" "$jpath" "$value"
}

Expand All @@ -100,7 +100,7 @@ parse () {
esac
}

[[ -n $1 && $1 == "-b" ]] && BRIEF=1
([ -n "$1" ] && [ "$1" = "-b" ]) && BRIEF=1

if [ $0 = $BASH_SOURCE ];
then
Expand Down

0 comments on commit b974624

Please sign in to comment.