Sujet : Re: [ksh] Show command number in shell prompt
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.unix.shellDate : 24. Sep 2024, 23:53:22
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240924153833.173@kylheku.com>
References : 1 2 3 4 5
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-09-24, Keith Thompson <Keith.S.Thompson+
u@gmail.com> wrote:
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
On Tue, 24 Sep 2024 15:23:56 +0200, Janis Papanagnou wrote:
[*] Note: Closing a shell window and re-opening it anew will work on the
previous, same history file.
>
I typically have over a dozen shell windows open at a time. They would all
happily clobber the same history file, which somewhat limits its use for
me.
>
Using a different $HISTFILE for each shell avoids that. I assign
consistent names to shell windows, under tmux, and I construct $HISTFILE
from the name.
In the TXR Lisp listener, I implemented an incredible idea from the
far future: on exit, it combines the to-be-saved history with new
material that may have appeared in the history file by the termination
of a parallel session.
The algorithm is
1. Load the existing history (using a new, shadow instance of the
listener object), and save it to a temporary file, trimming the
amount of history to the currently configured limit.
2. Append to that temporary file all the new lines from the
current session.
3. Rename the temporary file to the real history file name.
There is no locking: don't be somehow exiting your interactive sessions
simultaneously.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca