1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-12-27 06:59:45 +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//-/-2d}"
name="${name// /_}"
result+="$name"
result="$result$name"
else
local length="${#name}"
local char i
@ -17,11 +17,11 @@ encode_name() {
for ((i=0; i<length; i++)); do
char="${name:$i:1}"
if [ "$char" = " " ]; then
result+="_"
result="$result_"
elif [[ "$char" =~ [[:alnum:]] ]]; then
result+="$char"
result="$result$char"
else
result+="$(printf -- "-%02x" \'"$char")"
result="$result$(printf -- "-%02x" \'"$char")"
fi
done
fi