bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Negative COMP_CWORD values?


From: Chet Ramey
Subject: Re: Negative COMP_CWORD values?
Date: Fri, 24 Jul 2009 20:20:27 -0400
User-agent: Thunderbird 2.0.0.22 (Macintosh/20090605)

Ville Skyttä wrote:
> Hello,
> 
> Is it intentional that COMP_CWORD may have a negative value within a 
> completion function?  I did not find any indication of that in the bash man 
> page.  For example:
> 
>     foo()
>     {
>             echo "COMP_CWORD:$COMP_CWORD"
>     }
>     complete -F foo bar
> 
> Then, type "bar  " (sans quotes, two spaces), go back between the two spaces 
> and hit tab.  All bash versions I've tried with (various 3.x and 4.0 ones) 
> print out COMP_CWORD:-2.  The -2 will obviously not work too well with things 
> like ${COMP_WORDS[COMP_CWORD]} (bad array subscript).

Thanks for the report.  This will be fixed in either a patch or the next
version of bash.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]