process substitution
Bash supports process substitution. This allows you to open a file descriptor for either standard in or standard out for a process. For example, I can open fd 9 to read the output of the ls command:
Code:
exec 9< <(ls) Code:
read -u 9 Code:
cat <&9 I can do that with stdin as well Code:
exec 9> >(cat) |
To Answer my own post... It looks like this is not possible in bash. It is however possible in zsh (and some others) with the coproc builtin. So, you can....
# start zsh bash $ zsh # start coproccess zsh $ coproc somecommand_or_pipeline # redirect its stdin and stdout to numbered fds zsh $ exec 6>&p 7<&p # run bash again, and the fd's get inherited zsh $ bash bash $ |
All times are GMT -5. The time now is 11:22 PM. |