Sujet : Re: Different variable assignments
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shellDate : 12. Oct 2024, 22:47:34
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <veeqpn$au42$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 12.10.2024 23:32, Lawrence D'Oliveiro wrote:
On Sat, 12 Oct 2024 17:57:16 +0200, Frank Winkler wrote:
I'm still thinking about the difference between "< <(...)" and "<<<
`...`"
Not sure about the extra “<”,
'<(...)' executes the command indicated by '...' and provides a file
descriptor, something like '/dev/fd/5', which (being effectively a
filename) can be redirected to the 'read' command.
The shell's 'read' command doesn't read from files but from stdin,
so if 'read's input is in a file or is the output of a command (as in
this case) you have to do a redirection; for the first case
read < file
and in case of a process substitution (a file named like /dev/fd/5)
read < <(some command)
which sort of "expands" to something like
read < /dev/fd/5
So it's no "extra" '<', it's just a necessary redirection for a
command that reads from 'stdin' but not from files.
Janis
but “<(«cmd»)” gets substituted with the
name of a file (i.e. not stdin) that the process can open and read to get
the output of «cmd». Similarly “>(«cmd»)” gets substituted with the name
of a file (i.e. not stdout) that the process can open and write to feed
input to waiting «cmd».
[...]