Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我netstat -t 1 -i 2>&1 > $NETStat_OUT_FILE &在脚本中运行此命令时,netstat 的输出不会重定向到文件。任何人都可以找到解决方案吗?
netstat -t 1 -i 2>&1 > $NETStat_OUT_FILE &
您需要先重定向标准输出,然后再重定向标准错误。
netstat -t 1 -i > $NETStat_OUT_FILE 2>&1 &
为了解决计时问题,您可以使用等待:
netstat ... & p=$! do something else ... wait $p