Coprocess FD not available when duplicated to FD other than 1 or 2
From:
lolilolicon
Subject:
Coprocess FD not available when duplicated to FD other than 1 or 2
Date:
Wed, 19 Oct 2016 20:24:55 +0800
The following correctly prints "fd=2":
coproc p { head -1; }
2>&${p[1]} bash -c 'echo fd=2 >&2'
cat <&${p[0]}
Change 2 to 3, throws error: "bash: 3: Bad file descriptor":
coproc p { head -1; }
3>&${p[1]} bash -c 'echo fd=3 >&3'
cat <&${p[0]}
I'm not very familiar with redirection, so I may have overlooked
something obvious...
What am I missing?