[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comments on bash 5.2's undocumented <(<file) and weird >(<file)
From: |
Dale R. Worley |
Subject: |
Re: Comments on bash 5.2's undocumented <(<file) and weird >(<file) |
Date: |
Fri, 05 Jul 2024 16:10:55 -0400 |
Emanuele Torre <torreemanuele6@gmail.com> writes:
> Bash 5.2 apparently added <(< file) that expand to the path to a fifo
> (openable only for read on BSD) to which the contents of file are
> written to, without documenting it.
I suspect that this is a consequence of
The comâ
mand substitution $(cat file) can be replaced by the equivalent but
faster $(< file).
(Which oddly enough, I suggested for Bash some decades ago.) In the
latter form, Bash doesn't set up a subprocess and then read the pipe
from it but instead just reads the named file. Or rather, that was the
initial implementation. I suspect that the code has been updated so
that an "inner command" of "< file" now copies "file" to stdout (as if
it was cat), and the various results you see are based on what the
parent process does with that output.
Dale