The coproc keyword

来源:互联网 发布:matlab数据相关性分析 编辑:程序博客网 时间:2024/04/30 15:02

http://wiki.bash-hackers.org/syntax/keywords/coproc

http://unix.stackexchange.com/questions/18886/why-is-while-ifs-read-used-so-often-instead-of-ifs-while-read




A coprocess' file descriptors are accessible only to the process from which the coproc was started.


coprocess 生成 的 fd ,仅能 在运行  coproce 的 shell内 进行访问。


$ coproc awk '{print "foo" $0;fflush()}'[2] 23100$ while IFS= read -ru ${COPROC[0]} x; do printf '%s\n' "$x"; done & # 这里会出错,这个子进程 不是运行 coproce 的 shell。[3] 23104

原创粉丝点击