[Bash-completion-devel] local and arrays

dnade.ext at orange.com dnade.ext at orange.com
Wed Sep 18 11:23:34 UTC 2013


	Hello

Please consider the following patch. I's not really an important one but it's more about doing what you actually want to do.

It happens that "local foo=()" doesnt declare an array named foo. It actually declare a regular variable with the string '()' as value (as in "foo='()'").

Regards, 

	D


diff --git a/bash_completion b/bash_completion
index 08ce365..91f9949 100644
--- a/bash_completion
+++ b/bash_completion
@@ -304,7 +304,8 @@ __reassemble_comp_words_by_ref()
 # @see __reassemble_comp_words_by_ref()
 __get_cword_at_cursor_by_ref()
 {
-    local cword words=()
+    local cword
+    local -a words
     __reassemble_comp_words_by_ref "$1" words cword
 
     local i cur index=$COMP_POINT lead=${COMP_LINE:0:$COMP_POINT}
@@ -374,8 +375,8 @@ __get_cword_at_cursor_by_ref()
 _get_comp_words_by_ref()
 {
     local exclude flag i OPTIND=1
-    local cur cword words=()
-    local upargs=() upvars=() vcur vcword vprev vwords
+    local cur cword vcur vcword vprev vwords
+    local -a words upargs upvars
 
     while getopts "c:i:n:p:w:" flag "$@"; do
         case $flag in


--
Damien Nadé <dnade.ext at orange.com>
Astek Sud-Est pour France Télécom - FT/OF/OFA/DMGP/PORTAIL/DOP/DEV/EAQS
Sophia Antipolis - France / Tel : 04 97 46 28 74



_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.



More information about the Bash-completion-devel mailing list