bug-bash
[Top][All Lists]
Advanced

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

Re: history -f filename


From: Eric Pruitt
Subject: Re: history -f filename
Date: Mon, 2 Dec 2024 15:17:30 -0800

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 PID' shell.

The function was declared with parentheses rather than brackets
surrounding the body, so it won't run in the same process as the parent
shell unless I'm missing something:

    ~$ echo Parent: $BASHPID; f() { echo Function: $BASHPID; }; f
    Parent: 2484818
    Function: 2484818
    ~$ echo Parent: $BASHPID; f() ( echo Function: $BASHPID ); f
    Parent: 2484818
    Function: 2493192

Eric



reply via email to

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