Bash Anonymous Pipes

笑着哭i 提交于 2019-12-04 03:00:44

Whe you use <( ... ) for process substitution, the process running inside does not have a controlling terminal. But pv always shows its results to the terminal; if there isn't any, it gets stopped.

If you execute your code and, while it is running, do a ps axf, you will see something like this:

23412 pts/16   S      0:00  \_ bash
24255 pts/16   S+     0:00      \_ cat /dev/zero
24256 pts/16   S+     0:00      \_ tee /dev/fd/63
24258 pts/16   S      0:00      |   \_ bash
24259 pts/16   T      0:00      |       \_ pv -c
24257 pts/16   S+     0:00      \_ pv -c

...which tells you that the pv -c executed inside the process substitution (the one below the second bash) is in T state, stopped. It is waiting to have a controlling terminal in order to run. It does not have any, so it will stop forever, and bash eventually stops sending data to that pipe.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!