Re: history -f filename

2024-12-02 Thread Chet Ramey
On 12/2/24 5:05 PM, Lawrence Velázquez wrote: On Mon, Dec 2, 2024, at 3:27 PM, Chet Ramey wrote: On 11/30/24 10:41 PM, Lawrence Velázquez wrote: On Sat, Nov 30, 2024, at 9:36 PM, Dan Jacobson wrote: We see for simple $ history output, there's no way to change the file it reads, at least with t

Re: history -f filename

2024-12-02 Thread Eric Pruitt
On Mon, Dec 02, 2024 at 12:27:41PM -0800, Chet Ramey wrote: > On 11/30/24 10:41 PM, Lawrence Velázquez wrote: > > history_f() ( > > history -c && > > history -r -- "$1" && > > history > > ) > > history_f .bash_history_foobar > > That *is* the `same P

Re: history -f filename

2024-12-02 Thread Lawrence Velázquez
On Mon, Dec 2, 2024, at 3:27 PM, Chet Ramey wrote: > On 11/30/24 10:41 PM, Lawrence Velázquez wrote: >> On Sat, Nov 30, 2024, at 9:36 PM, Dan Jacobson wrote: >>> We see for simple >>> $ history >>> output, there's no way to change the file it reads, at least with the >>> current (same PID) shell. >

Re: history -f filename

2024-12-02 Thread microsuxxor
se ~/.bash_history. > Alas, it also says > history: history [-c] [-d offset] [n] or > history -anrw [filename] or > history -ps arg [arg...] > > So if one wants to use a filename, then one needs to use -anrw (-[anrw]). > > So maybe a new -f is needed: > $ histo

Re: history -f filename

2024-12-02 Thread Chet Ramey
On 11/30/24 10:41 PM, Lawrence Velázquez wrote: On Sat, Nov 30, 2024, at 9:36 PM, Dan Jacobson wrote: We see for simple $ history output, there's no way to change the file it reads, at least with the current (same PID) shell. Why is "same PID" a requirement? Why isn't something like this suff

Re: history -f filename

2024-12-02 Thread Chet Ramey
then reload the history from the temporary file. 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>

Re: history -f filename

2024-11-30 Thread Lawrence Velázquez
On Sat, Nov 30, 2024, at 9:36 PM, Dan Jacobson wrote: > We see for simple > $ history > output, there's no way to change the file it reads, at least with the > current (same PID) shell. Why is "same PID" a requirement? Why isn't something like this sufficient? history_f() (

Re: history -f filename

2024-11-30 Thread Greg Wooledge
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

Re: history -f filename

2024-11-30 Thread Dan Jacobson
e 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

Re: history -f filename

2024-11-30 Thread Chet Ramey
emory history list. So maybe a new -f is needed: $ history -f filename to simply read from filename. What exactly would this do? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU

history -f filename

2024-11-29 Thread Dan Jacobson
history -anrw [filename] or history -ps arg [arg...] So if one wants to use a filename, then one needs to use -anrw (-[anrw]). So maybe a new -f is needed: $ history -f filename to simply read from filename.