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.
>> 
>> Why is "same PID" a requirement?  Why isn't something like this
>> sufficient?
>> 
>>      history_f() (
>>              history -c &&
>>              history -r -- "$1" &&
>>              history
>>      )
>>      history_f .bash_history_foobar
>
> That *is* the `same PID' shell.

Doesn't the subshell have a different PID?

(In any case, it's possible to avoid the subshell by restoring the
history list manually, as you've mentioned already.  I just wanted
to keep the example simple.)

-- 
vq

Reply via email to