[Top][All Lists]

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

Re: What should be the expected behavior for $_ ?

From: Chet Ramey
Subject: Re: What should be the expected behavior for $_ ?
Date: Mon, 25 Nov 2019 09:33:27 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

On 11/25/19 9:21 AM, Siteshwar Vashisht wrote:

It's an interesting question. You want $_ to expand to the last argument
(or last word) of the previous history entry when the shell is interactive,
which is available as !$, instead of the last command executed by the
current shell instance.

Should the command line know about shell functions and commands executed in
the foreground on its behalf? What should the behavior be in a
non-interactive shell? What do folks think?

Can we at least document this behavior in man page if we can't change it ?

I think the current language works pretty well:

"Subsequently, expands to the last argument to the previous simple
command executed in the foreground, after expansion."

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/

reply via email to

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