[Top][All Lists]

[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: Thu, 31 Mar 2011 21:47:34 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20110221 Lightning/1.0b2 Thunderbird/3.1.8

On 3/15/11 4:44 PM, Chet Ramey wrote:
>> Bash Version: 4.2
>> Patch Level: 7
>> Release Status: release
>> Description:
>>         When enter in console "ls $HOME/" and press TAB for
>> completion, then bash add slash for special characters like $ { }
>>         When I back to wersion 4.1_p10 then problem is gone. Problem
>> also exists with 4.2_p6 and 4.2_p1 (these veriosn I have checked).
> The difference is that bash-4.1 expanded $HOME and left the expansion
> as part of the replacement text.  Bash-4.2 tries to leave what the
> user typed alone, but that leads to an inherently ambiguous situation:
> when do you quote the `$' in a filename (or, in this case, a directory
> name)?  It could be a shell variable, and it could be a character in
> the filename. 

I've attached a patch that applies a heuristic.  If the directory name
contains a variable, and bash expands it, it removes the appropriate
characters from the set that causes readline to ask bash to quote the
filename.  It's the 90% solution.

It is not perfect: if a character in the filename needs to be quoted,
bash will still quote the `$' in the directory name.  It should handle
most of the cases, however.

If you're interested, apply it with `patch -p0' and see whether or not
it works.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

Attachment: completion-quoting
Description: Text document

reply via email to

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