remove "+=" operator to support bash-3.0

This commit is contained in:
Alec Chen 2012-04-23 22:11:19 +08:00
parent e5c64db280
commit 3a94daeaf8

View file

@ -85,7 +85,7 @@ shim_variable_name() {
if [[ ! "$shim" =~ [^[:alnum:]_-] ]]; then if [[ ! "$shim" =~ [^[:alnum:]_-] ]]; then
shim="${shim//_/_5f}" shim="${shim//_/_5f}"
shim="${shim//-/_2d}" shim="${shim//-/_2d}"
result+="$shim" result="$result$shim"
else else
local length="${#shim}" local length="${#shim}"
local char i local char i
@ -93,9 +93,9 @@ shim_variable_name() {
for ((i=0; i<length; i++)); do for ((i=0; i<length; i++)); do
char="${shim:$i:1}" char="${shim:$i:1}"
if [[ "$char" =~ [[:alnum:]] ]]; then if [[ "$char" =~ [[:alnum:]] ]]; then
result+="$char" result="$result$char"
else else
result+="$(printf "_%02x" \'"$char")" result="$result$(printf "_%02x" \'"$char")"
fi fi
done done
fi fi