Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 43 |
Nodes: | 6 (0 / 6) |
Uptime: | 108:38:48 |
Calls: | 290 |
Files: | 905 |
Messages: | 76,698 |
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?
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.
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'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 don't use this feature, and I don't have ksh, just bash and zsh.
Bash has separate options for
\! the history number of this command
\# the command number of this command
I don't know what your goal is, but maybe ksh has these two options, and you want the other one?
[*] Note: Closing a shell window and re-opening it anew will work on the previous, same history file.
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.
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.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
If you use numbered history references, they refer to the history
number, not the command number. For example, !25 will execute the 25th
command from your history. This could be confusing if you show the
command number in $PS1.
And of course the "history" command shows history numbers, not command numbers.
The command number doesn't seem to be used for anything other than
showing the number of commands issued in the current shell process. (Personally, I don't find the command number to be useful information.)
Of course I have a more complex setup that uses an own history file
per "window"; I use for example a name like ".sh_history_pts_57"
(using 'HISTFILE').
On Wed, 25 Sep 2024 00:41:21 +0200, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
Of course I have a more complex setup that uses an own history file
per "window"; I use for example a name like ".sh_history_pts_57"
(using 'HISTFILE').
I do that per "project"
To switch projects, I source a bash script which ends like this:
[...]
test -f .fslckout && fossil status
test -f .fslckout && fossil stash list --verbose
[...]
test -f .fslckout && fossil status
test -f .fslckout && fossil stash list --verbose
What is 'fossil'?