Permalink
Browse files

Remove most bashisms from main script

  • Loading branch information...
1 parent 680fa94 commit b97462416f1ef5fee1f03d94a8659e28a65dd38e @aidanhs aidanhs committed Mar 12, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 JSON.sh
View
@@ -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
@@ -74,7 +74,7 @@ parse_object () {
done
;;
esac
- [[ $BRIEF -ne 1 ]] && value=`printf '{%s}' "$obj"`
+ [ $BRIEF -ne 1 ] && value=`printf '{%s}' "$obj"`
}
parse_value () {
@@ -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"
}
@@ -100,7 +100,7 @@ parse () {
esac
}
-[[ -n $1 && $1 == "-b" ]] && BRIEF=1
+([ -n "$1" ] && [ "$1" = "-b" ]) && BRIEF=1
if [ $0 = $BASH_SOURCE ];
then

0 comments on commit b974624

Please sign in to comment.