From: Brandon Casey Date: Wed, 21 Aug 2013 20:49:32 +0000 (-0700) Subject: t9902-completion.sh: old Bash still does not support array+=('') notation X-Git-Tag: v1.8.4.1~7^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0ef09702d6b7fbd225d1e7adeca7b32304be529f?ds=inline;hp=--cc t9902-completion.sh: old Bash still does not support array+=('') notation Old Bash (3.0) which is distributed with RHEL 4.X and other ancient platforms that are still in wide use, does not understand the array+=() notation. Let's use an explicit assignment to the new array element which works everywhere, like: array[${#array[@]}+1]='' The right-hand side '' is not strictly necessary, but in this case I think it is more clear. Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- 0ef09702d6b7fbd225d1e7adeca7b32304be529f diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 272a071e85..2d4beb5e50 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -69,7 +69,7 @@ run_completion () local -a COMPREPLY _words local _cword _words=( $1 ) - test "${1: -1}" = ' ' && _words+=('') + test "${1: -1}" = ' ' && _words[${#_words[@]}+1]='' (( _cword = ${#_words[@]} - 1 )) __git_wrap__git_main && print_comp }