sh/jshn.sh: fix allowing numbers in identifiers

json_add_generic() needs to handle them as well
This commit is contained in:
Felix Fietkau 2012-05-17 14:29:59 +02:00
parent 592f2dbd82
commit 94ff2a0abb

View file

@ -24,7 +24,7 @@ json_add_generic() {
var=$(( ${aseq:-0} + 1 )) var=$(( ${aseq:-0} + 1 ))
export -- "SEQ_$cur=$var" export -- "SEQ_$cur=$var"
else else
local name="$(echo -n "$var" | tr -C '[a-zA-Z_]' _)" local name="$(echo -n "$var" | tr -C '[a-zA-Z0-9_]' _)"
[[ "$name" == "$var" ]] || export -- "NAME_${cur}_${name}=$var" [[ "$name" == "$var" ]] || export -- "NAME_${cur}_${name}=$var"
var="$name" var="$name"
fi fi