From a97368c74ffe9a0614fb7f4185041e97a16469db Mon Sep 17 00:00:00 2001 From: Tyler Akins Date: Tue, 21 Feb 2017 11:00:39 -0600 Subject: [PATCH] Fixing the array slicing for Bash 3 This IFS problem only happens on Bash 3 in some circumstances. --- mo | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mo b/mo index dcd009d..9bd20d1 100755 --- a/mo +++ b/mo @@ -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}\")" }