bug-bash
[Top][All Lists]
Advanced

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

Re: How to get filename completion without variable expansion?


From: Chet Ramey
Subject: Re: How to get filename completion without variable expansion?
Date: Thu, 17 Nov 2011 11:22:27 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

On 11/16/11 7:13 AM, jens.schmidt35@arcor.de wrote:
> Hi,
> 
> I have the following problem:
> 
> (Environment or regular) variable FOO contains the path of existing directory 
> "/foo".  When I have a file "/foo/bar" in that directory and when I press TAB 
> in the following commandline ('|' denoting the cursor position)
> 
>   $ cat $FOO/b|<TAB>
> 
> bash expands the commandline to
> 
>   $ cat /foo/bar |
> 
> However, I would like to expand it to
> 
>   $ cat $FOO/bar |
> 
> that is, keep the variable unexpanded, exactly as bash does not expand tilde 
> characters during filename completion.

This is the default bash-4.2 behavior.  There has been some controversy
surrounding the behavior change.  Take a look at

http://lists.gnu.org/archive/html/bug-bash/2011-09/msg00007.html

for a brief discussion of the issues and a patch that adds several things
to make completion work more flexibly in the face of shell variable
expansion.  A version of that patch will appear in bash-4.3.

Chet
-- 
``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]