I was hoping to do something like this:
echo 'foo' >&3 3| cat
Basically, I want to write 'foo
' to 3
, and then only pipe the data in 3
to cat
. But the above doesn't work, I get:
bash: 3: Bad file descriptor
Does anyone understand what I am trying to do?
With Node.js, I have working example, here: https://gist.github.com/ORESoftware/0ad178f4512bbf956e54dd08f2412883
In that Node.js gist, which seems reliable, at the command line we do:
node foo.js 3> some-file.sh
and in the node process we are writing to the 3
file descriptor.
But I am wondering how to do it with pipes instead of redirection.
Something like this:
node foo.js 3| cat
mkfifo
and wire two commands together in subshells. Something like this https://unix.stackexchange.com/a/18903/85039 – Sergiy Kolodyazhnyy Aug 26 '19 at 06:23