logo       

Re: bash: History substitution doesn't happen after ^V^J.: msg#00255

shells.bash.bugs

Subject: Re: bash: History substitution doesn't happen after ^V^J.

> Version: 2.05a-11
>
> Type the following.
>
> $ echo foo<Return>
> foo
> $ echo !$<Return>
> foo
> $ echo 'a^V^J
> b' !$<Return>
> a
> b !$
> $
>
> If I split the quoted string over multiple lines, history substitution
> doesn't seem to happen apart from on the first line.

History expansion is done on a per-line basis, not per-token. It is performed
before the shell parser sees the line.

At the point the second line is read and history expanded, the parser's state
is still `open single quote', so expansion is inhibited.

I'd rather err on the side of not performing history expansion where it could
possibly be done instead of performing it when it should not.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live...Laugh...Love
Chet Ramey, ITS, CWRU chet@xxxxxxxxxxx http://tiswww.tis.cwru.edu/~chet/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise