Sujet : Re: [ksh] Show command number in shell prompt
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shellDate : 24. Sep 2024, 14:23:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vcuehc$37dtm$1@dont-email.me>
References : 1 2
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 24.09.2024 14:59, hymie! wrote:
In our last episode, the evil Dr. Lacto had captured our hero,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com>, who said:
Not long ago I added an '!' (exclamation mark) to my prompt to have
it get expanded to the command number [in Kornshell]; PS1='(!)$ '
The effect is that a new shell instance starts with the number 1000
which incidentally equals the HISTSIZE. - Any ideas what could have
gone wrong here?
Nothing has gone wrong.
HISTSIZE=1000 means that the maximum size of your history is 1000. Once it
hits that level, the oldest entries are dropped, and the newest entries
are added to the end.
So every command you issue is always the last command in the history.
Since the history is full, it's always command number 1000.
Hmm.. - that explains, maybe, part of it. Thanks.
I'm still irritated; if I see in one shell session a value of 11059
(which is an indication that the numbers created by '!' don't wrap)
I'm astonished that the counting in a new window will start at 1000
(and not at 1 or at the maximum previous value).
I've just closed a window with an actual maximum command number of
1643, and "restoring"[*] that window will continue at 1643.
Still puzzling...
Janis
[*] Note: Closing a shell window and re-opening it anew will work
on the previous, same history file.