bug-bash
[Top][All Lists]
Advanced

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

Re: history -s from inside function replaces last command rather than ad


From: Chet Ramey
Subject: Re: history -s from inside function replaces last command rather than adding to it
Date: Wed, 18 Dec 2024 09:19:27 -0500
User-agent: Mozilla Thunderbird

On 12/17/24 5:19 PM, Dale R. Worley wrote:
Chet Ramey <chet.ramey@case.edu> writes:
What is the point of "history -s args", then?  What is it useful for?

To add arbitrary data to the history list, for whatever reason a user
likes. I think the documentation is fairly clear on that.

To be more specific, it adds arbitrary data to the history list, but
also necessarily removes an entry from the history list.  This is
exactly the combination you want when the user types "history -s foo bar
baz" at the prompt,

That's the primary use case.

 but it's tough to use programatically:  How would
you code a function for use in scripts that adds an entry "foo bar baz"
to the history list without removing anything already on the history
list?

Add a dummy command to the history, or expect the function call to be
removed, or both?

--
``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/



reply via email to

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