bug-bash
[Top][All Lists]
Advanced

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

Re: history -f filename


From: Dan Jacobson
Subject: Re: history -f filename
Date: Sun, 01 Dec 2024 10:36:53 +0800

$ history |wc - $HISTFILE|sed \$d
   7622   75741  532254 -
  14973   29625  320996 /home/jidanni/.bash_history_jidanni
Works as expected.

$ (a=~/.bash_history_jidanni-emacs; HISTFILE=$a history |wc - $a|sed \$d)
   7625   75780  532531 - ### I expected to see about 1399/2 here.
   1399    3535   35312 /home/jidanni/.bash_history_jidanni-emacs
We see for simple
$ history
output, there's no way to change the file it reads, at least with the
current (same PID) shell.

>>>>> "CR" == Chet Ramey <chet.ramey@case.edu> writes:
CR> Use `history -r'?
That would change files (by more than just one line).
All I want is a read-only operation.

CR> Because those are the options that act on the history file. The rest act
CR> on the in-memory history list.

>> So maybe a new -f is needed:
>> $ history -f filename
>> to simply read from filename.

CR> What exactly would this do?

It would do just like plain
$ history
but instead of reading from the in memory list,
(which is about the same as $HISTFILE + or - one line)
it would read from the given file.



reply via email to

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