[Top][All Lists]

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

Multi-word matching in history expansion

From: The Wanderer
Subject: Multi-word matching in history expansion
Date: Sun, 30 Sep 2007 19:29:22 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922

I'm not entirely sure that this is the appropriate forum for this kind
of question, since the issue at hand does not seem to be in any respect
a bug, but I haven't found any better one; if there's something I've
missed, please let me know.

I am presently running bash 3.1.17, obtained via Debian. Quite some time
and several varyingly-significant updates of bash ago, I was able to
perform history expansion on multi-word commands. E.g., with the sample

ls /home/
ls /tmp/

the command

!ls /h

would expand to

ls /home/

At present and for some while now, it instead expands to

ls /tmp/ /h

I think I can understand how the new behaviour could be desirable in
some circumstances, but there are far more occasions on which I want to
be able to repeat an exact multi-word command than occasions on which I
want to be able to repeat the $0 of a multi-word command and provide new
arguments. Most of the time, retyping that part of the command is quite
trivial even without its being present in the history (all the more so
because of tab completion), to the point where I have never so much as
thought of using history expansion for the purpose; re-adding a
potentially very long list of arguments tends to be very much more
effort in most cases.

I do not see any indication in the documentation I know about (primarily
the man page, plus what little I have found via Google) of any way to
obtain the old behaviour. Is there something I've missed?

If not, is there any chance that such a way could be provided?

As an entirely separate question: is there any way to 'repeat' a past
command, so as to bring it to the most recent position in the history
buffer, without having to actually execute it? The comment character #
(which I have recently discovered is formally the history comment
character) is the standard way to place a command in the history without
executing it, but for somewhat obvious reasons that does not work with
history expansion. I do not have an example ready to mind, but there
have been times when I would have found this ability useful.

      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]