Re: history writes to process substitution but errors reading it
From:
Chet Ramey
Subject:
Re: history writes to process substitution but errors reading it
Date:
Fri, 14 Feb 2025 09:48:03 -0500
User-agent:
Mozilla Thunderbird
On 2/14/25 5:31 AM, MacBeth wrote:
Ummm, isn't this supposed to work? I'm guessing there's a technical
reason why it doesn't...?
# fails:
$ history -r <(echo 'echo bad')
It fails because the history library requires the file to be a regular
file. It tries to read and write atomically, so the read history function
gets the size of the history file, allocates one big buffer to hold it,
and reads it in one go.
I think it's reasonable for the history builtin to report read errors here,
something like this:
bash: history: /dev/fd/63: read error: Inappropriate file type or format
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/