~ bash --version
GNU bash, version 3.2.51(1)-release (sparc-sun-solaris2.10)
Copyright (C) 2007 Free Software Foundation, Inc.
以下命令按预期工作:
~ ls hdfhdfhdhfd 2> >(wc -l)
1
......但这不起作用,我已经没有想法找出原因:
~ truss -eaf bash -c 'true' 2> >( some command to process text)
内部的命令>()最终阻塞等待输入。
如果我这样做:
~ (true; truss -eaf bash -c 'true') 2> >( some command )
...它按预期工作,尽管这不起作用:
~ ( truss -eaf bash -c 'true') 2> >( some command )
# ^^^^^ ... note the 1st command is missing
如果我制作some command= dd bs=1,它会消耗并打印所有文本桁架会吐出的stderr,然后阻塞。
我无法在 Linux 中重现类似的行为,只有truss在 solaris 中使用时。