我想在Bash中执行一个长时间运行的命令,并且都捕获它的退出状态
所以我这么做:
command | tee out.txt
ST=$?
问题在于,变量ST捕获了tee
而不是命令。我怎么解决这个问题?
发布于 2018-02-07 04:09:46
通过命名管道(Mkfifo)将它们连接起来。然后可以运行第二个命令。
mkfifo pipe
tee out.txt < pipe &
command > pipe
echo $?
https://stackoverflow.com/questions/-100003464
复制相似问题