我在对cyberciti.biz的评论中看到了这个有趣的问题.
我发现我甚至找不到一种灵活的方法来用sh执行单行命令.
到目前为止,我对解决方案的想法是:
tmp_file=`mktemp`
(./script 2>$tmp_file >/dev/null; cat $tmp_file) | ./other-script
rm tmp_file
Run Code Online (Sandbox Code Playgroud)
但是你看,这不是同步的,而且很致命,它太难看了.
欢迎大家分享一下这个.:)