bug-bash
[Top][All Lists]
Advanced

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

Re: Multi-word matching in history expansion


From: The Wanderer
Subject: Re: Multi-word matching in history expansion
Date: Tue, 02 Oct 2007 06:47:29 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922

(And yet again. Not that it did a lot of good last time; I *still* got
an incorrect private reply, in addition to the public one. Is there any
particular reason why you ignored my explicit request to not get both
responses?)

Chet Ramey wrote:
The Wanderer wrote:

(And again.)

Bob Proulx wrote:

This is also what csh does in this situation too.  This type of
history substitution originated with csh and it would be the
standard against which other implementations would be compared.

That makes a certain amount of sense, although the behaviour itself
still does not.

What does csh do with e.g.

!ls\ /h

(that is, attempting to escape the space so as to prevent
tokenizing them separately)? I do not have csh installed, so I
can't test.

Bash imitates the csh behavior, and csh does not honor the escape.

I expected as much.

I would be interested to find out, if someone is present who does
know. I would also be interested to know the rationale behind the
behaviour, given that the only potentially real-world scenario I
can think of where this behaviour seems as if it would be useful is
in adding e.g. the '-g' flag to the end of a compiler command line,
but the other behaviour was useful to me in a wide variety of
circumstances.

It's a feature that was first implemented in csh, and bash attempts
to mimic the csh behavior.

That's the rationale for doing it in bash, but not the rationale for
doing it at all.

I would also be curious to know the exact reason why escaping the
space does not cause it to be treated as part of the initial
command to be matched and so form an effective workaround, but I
suspect that there is no practical way to explain that better than
is done by the source itself.

Because history expansion simply does not honor backslash quoting in
that context, and whitespace delimits the history event.  It's no
more complicated (and no simpler) than that.

That's not a reason; that's just a description of the behaviour. I want
to know *why* it does not honor it, and as I said, probably the only
effective way to find that out is to read the source.

(For the technical "why", at least. For the theoretical "why", it
reduces to the same question about the rationale, above.)

--
      The Wanderer

Warning: Simply because I argue an issue does not mean I agree with any
side of it.

Secrecy is the beginning of tyranny.




reply via email to

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