On 4/5/21 1:31 PM, konsolebox wrote:
Not sure if this is a bug or a limitation but this works:
# echo a | ( exec {fd}>/path/to/regular/file; tee /dev/fd/"$fd" )
While this produces a "No such device or address" error:
# echo a | ( exec {fd}>/dev/tcp/host/port; tee /dev/fd/"$fd" )
There's no guarantee that file descriptors opened with socket(2) show up in
/dev/fd. Bash doesn't emulate /dev/fd if the system provides it, so it's up
to the OS on those systems whether they do or not.
It doesn't generate that error on macOS, for instance, which has /dev/fd.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/