bug-bash
[Top][All Lists]
Advanced

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

Re: history -f filename


From: Greg Wooledge
Subject: Re: history -f filename
Date: Sat, 30 Nov 2024 21:48:17 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

On Sun, Dec 01, 2024 at 10:36:53 +0800, Dan Jacobson wrote:
> $ history |wc - $HISTFILE|sed \$d
>    7622   75741  532254 -
>   14973   29625  320996 /home/jidanni/.bash_history_jidanni
> Works as expected.

So, you have 7622 lines of history in memory, and 14973 lines in
that file.

> $ (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

Why did you expect that?  You still ran the exact same history command
as before, just with the HISTFILE variable set.  But "history" with
no arguments doesn't care about that variable.  It simply reports the
history lines in memory -- currently up to 7625, 3 more than before.

> We see for simple
> $ history
> output, there's no way to change the file it reads, at least with the
> current (same PID) shell.

It doesn't read ANY file.  It's reporting what's in memory.



reply via email to

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