[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Negative COMP_CWORD values?
From: |
Ville Skyttä |
Subject: |
Negative COMP_CWORD values? |
Date: |
Thu, 23 Jul 2009 00:08:57 +0300 |
User-agent: |
KMail/1.11.4 (Linux/2.6.29.3-60.fc10.x86_64; KDE/4.2.4; x86_64; ; ) |
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).
Please Cc me in replies, I'm not subscribed to bug-bash at the moment.
- Negative COMP_CWORD values?,
Ville Skyttä <=