我读过的内容$coproc < command >不同于$< command > &与在子 shell 进程中coproc执行的command
但当我测试它时,它的工作原理就像$< command > &. 测试如下:
第一:测试行为$< command > &。
$nano &在tty1上$ps -t tty1 --forest表明 nano 进程是 -bash 进程的子进程(登录 bash shell 进程 -> 未创建子 shell 进程)第二:测试行为$coproc < command >
$coproc nano在tty1上$ps -t tty1 --forest上面相同(没有创建子 shell 进程)也是如此$coproc < command >和一样吗$< command > &?
使用的 shell 是bash shell
区别在于创建了两个 I/O 通道,如下所述man bash:
协进程在子 shell 中异步执行,就像使用 & 控制运算符终止命令一样,并在执行 shell 和协进程之间建立双向管道。
| 归档时间: |
|
| 查看次数: |
2305 次 |
| 最近记录: |