It’s almost identical to <(echo foo), but crucially it drains the output before performing the substitution. It’s like <(... | sponge), but somehow much more reliable.
I’ve used it in a few situations where process substation failed, though being old and feeble I can’t remember why it failed. But for example you can copy the file safely, knowing that it will contain the full output of the shell pipeline, unlike process substitution.
I don’t even know the name of =(...). Hmm. Sponge substitution?
/dev/fd/11 is a named pipe, whereas /tmp/zshbEF1D9 is a plain file. There are situations where named pipes fail, where you actually do need a plain file, and I can't think of a single one offhand. :)
"I've run into it in the past" is all I can say. And the above snippet at least gives one specific example of a hypothetical case.
> There are situations where named pipes fail, where you actually do need a plain file
In general: If the command you are passing the named pipe to expects a file which it can randomly access, a named pipe won’t work.
I ran into this today using a python tool, yamldiff. I was trying to diff a local yaml file with one from a cluster obtained via kubectl, eg:
yamldiff localManifest.yaml <(kubectl get … —output yaml)
and it failed with python telling me the file wasn’t seekable. Then I remembered this thread which I had initially read a few days ago and tried =() (since I use shell) — and it worked!
I’ve used it in a few situations where process substation failed, though being old and feeble I can’t remember why it failed. But for example you can copy the file safely, knowing that it will contain the full output of the shell pipeline, unlike process substitution.
I don’t even know the name of =(...). Hmm. Sponge substitution?