bug-bash
[Top][All Lists]
Advanced

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

Re: Bug, or someone wanna explain to me why this is a POSIX feature?


From: Chet Ramey
Subject: Re: Bug, or someone wanna explain to me why this is a POSIX feature?
Date: Tue, 09 Aug 2011 19:56:01 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11

On 8/8/11 2:44 PM, Linda Walsh wrote:
> 
> I was testing functions in my shell,  I would cut/paste,
> thing is, with each past, I'd get my dir listed (sometimes multiple times)
> on each line entered.
> 
> Now I have:
> shopt:
> no_empty_cmd_completion on
> 
> i.e. it's not supposed to expand an empty line

Not quite.  It's supposed to suppress command completion in those contexts
where bash would attempt it if the word to be completed is empty.  That
includes empty lines, but there are other cases as well.  The `empty'
refers to the command name, not the command line.

> but type in
> function foo {
> <tab>return 1
> }
> ----
> When I hit tab it lists out all the files in my dir -- which
> explains why when I cut/paste, any tab-indented line will list
> out the dir, and if it is multiply indented, it will be listed
> once for each indent level!

Yes.  It's not attempting command completion, since it doesn't think
it's in a context where a command name is expected (the completion
line parsing is pretty ad-hoc -- it doesn't use the shell parser).  It's
attempting readline's default filename completion.  I'll have to see
whether it can be taught that this is a context where a command name is
valid, even though it's the second line of a multi-line construct.

If this is really a big deal, you can temporarily turn off command line
editing while cutting and pasting text into the shell.  That way you
won't be surprised.

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]