1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-12-28 15:39:44 +01:00

Remove fancy syntax for bash 3.00 compatibility

This commit is contained in:
ALLARD Antoine 2017-09-15 16:37:23 +02:00
parent 03608115df
commit 69cdc7f5e1

View File

@ -9,7 +9,7 @@ encode_name() {
name="${name//_/-5f}" name="${name//_/-5f}"
name="${name//-/-2d}" name="${name//-/-2d}"
name="${name// /_}" name="${name// /_}"
result+="$name" result="$result$name"
else else
local length="${#name}" local length="${#name}"
local char i local char i
@ -17,11 +17,11 @@ encode_name() {
for ((i=0; i<length; i++)); do for ((i=0; i<length; i++)); do
char="${name:$i:1}" char="${name:$i:1}"
if [ "$char" = " " ]; then if [ "$char" = " " ]; then
result+="_" result="$result_"
elif [[ "$char" =~ [[:alnum:]] ]]; then elif [[ "$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