bug-bash
[Top][All Lists]
Advanced

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

Re: Manual entry for !!:$


From: Chet Ramey
Subject: Re: Manual entry for !!:$
Date: Mon, 20 Jan 2025 11:39:24 -0500
User-agent: Mozilla Thunderbird

On 1/18/25 1:29 AM, Martin Schulte wrote:
Hello,

in 9.3.2 of https://www.gnu.org/software/bash/manual/bash.html we find:

!!:$ designates the last argument of the preceding command. This may be 
shortened to !$.

Shouldn't this be "the last word" instead of the "the last argument":

I can see this, since the section heading is Word Designators. However,
from the history library's perspective, every word on the line after
the first (zeroth) is an argument. History expansion considers the line
before the shell's word expansions.



$ echo hello > /dev/null
$ echo !!:$
echo /dev/null
/dev/null

5.2 states (correctly from my point of view):

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

It's the `simple command' and `after expansion' parts that make the
difference. I think you're equating what the history library sees
and what happens to simple commands.

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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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