Ian wrote: > The manual suggests I could move and close file descriptors with > > [n]>&digit- > > but I would need the equivalent of > > command1 >&>(...)- > > Digit might very well mean (just a) digit but here the process > substitution, of course, is replaced with /dev/fd/63, say, certainly > not a digit. What about something like this (highly non-portable):
run_with_tee() { _run_with_tee >(tee out) "$@" } _run_with_tee() { local fdpipeout=${1#/proc/self/fd/}; shift # Redirect+close not to leak the extra pipe FD >&$fdpipeout- "$@" } run_with_tee someCommand Greg Wooledge wrote: > When the shortcuts are too short, you need to fall back to the original > tools. In this case, >() is really just a shortcut for "create a FIFO, > and open it". Doing so by hand should give you the manual control you > need. At the very least, you can tell bash which FD number to use when > you open the FIFO. Yeah, but then you have the hassle to cleanup/delete the FIFO by yourself. And leave tons of them behind in case of errors.