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