bug-bash
[Top][All Lists]
Advanced

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

Re: bash tab variable expansion question?


From: Eric Blake
Subject: Re: bash tab variable expansion question?
Date: Thu, 24 Feb 2011 22:15:24 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Red Hat/3.1.7-3.el6_0 Mnenhy/0.8.3 Thunderbird/3.1.7

On 02/24/2011 03:14 PM, Michael Kalisz wrote:
> $ echo $PWD/<TAB>
> will expand the $PWD variable to your current directory
> 
> while in bash, version 4.2.0(1)-release:
> 
> $ echo $PWD/<TAB>
> will just escape the $ in front of the $ variable i.e:
> 
> $ echo \$PWD/
> The shell-expand-line (Ctrl-Alt-e) works but before I could use just TAB
> 
> Any hints why? Any way to get the 4.1 behavior in 4.2?
> 
> Can someone confirm... Is this a bug or a feature?

I'm not the developer, but in my mind, this is a welcome feature.
TAB-completion should NOT modify what I typed, and I consider the 4.1
behavior to be the bug.  Consider if I have parallel directory
structures a/c and b/c.  If I do:

d=a
$d/c/test
d=b
$d/c/test

I want to run two different programs.  Now, instead of a one-letter
name, consider that it is something longer, like $HOME.  If typing TAB
expands the variable, instead of keeping it intact, then I can't do:

$HOME/c/t-TAB
$HOME=b
UP-UP-ENTER

to repeat my test in a new directory, since tab completion wiped out
that I want to evaluate $HOME every time.  (The same goes for command
substitution - bash should never pre-maturely lock me in to a single
expansion during tab completion.)

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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