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    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to