Fixing the array slicing for Bash 3

This IFS problem only happens on Bash 3 in some circumstances.
This commit is contained in:
Tyler Akins 2017-02-21 11:00:39 -06:00
parent ecfc973c2f
commit a97368c74f
No known key found for this signature in database
GPG Key ID: 8F3B8C432F4393BD

7
mo
View File

@ -338,7 +338,12 @@ moIndirect() {
# Returns nothing.
moIndirectArray() {
unset -v "$1"
eval "$1=(\"\${@:2}\")"
# IFS must be set to a string containing space or unset in order for
# the array slicing to work regardless of the current IFS setting on
# bash 3. This is detailed further at
# https://github.com/fidian/gg-core/pull/7
IFS= eval "$1=(\"\${@:2}\")"
}