bug-bash
[Top][All Lists]
Advanced

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

Re: Completion of ENV variables seems to be broken - leading slash (or e


From: Chet Ramey
Subject: Re: Completion of ENV variables seems to be broken - leading slash (or even more) is added
Date: Sun, 10 Jul 2011 22:08:13 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10

On 7/10/11 6:41 PM, Linda Walsh wrote:
> 
> 
> pjodrr wrote:
> 
>> Hello,
>>
>> Am Dienstag, 15. März 2011 21:44:37 UTC+1 schrieb Chet Ramey:
>>> The bash-4.1 solution, though it modified what the user typed, did not
>>> result in any ambiguity.  A filename was a filename, and if it contained
>>> characters that needed to be quoted, readline did so.
>>>
>>> I might be able to finesse this issue and retain the bash-4.2 behavior
>>> by changing state when rewriting the directory name for opendir(2), but
>>> I have to think about it some more.
>>
>> you elsewhere suggested to write a completion function for cd
>> that does the expansion.  May I point out that the expansion
>> of variables is not only a matter with the cd command but
>> for any other command that expects directory or file names?
>> I understand the dilemma, nobody prevents me from creating
>> a directory named '$HOME' but what do I expect when typing
>> cd $HOME/<tab>...?
> 
> ----
>     It *SHOULD* expand $HOME since bash performs variable name expansion
> on the command line.

That's not the question.  The question is whether or not tab completion
should expand the variable reference before the command is executed.

>     If it doesn't, it is broken.

No, not exactly.  The discussion, if you've followed it, revolves around
whether or not the word completion code should modify what the user
typed.  There's a mechanism to force expansion during command entry:
the M-C-e emacs mode key binding will do that.  There's no mechanism in
bash versions through 4.1 to leave the command line unaltered while doing
word completion.

This will be optional behavior in the next release of bash.  Users will
be able to choose whether or not they want word completion to perform
variable expansion and update the command line with the results.

> Variable expansion on the command line has always been integral to the
> processing of the command line, are you saying this is broken in 4.2?

No, of course not.  A simple test would have verified that, had you
performed one.  The question is, as I said above, whether or not word
expansions should be performed before they are done as part of command
executions.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
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]