0
我有以下脚本:退出整个脚本{}
{
...
many commands and printing
...
if something goes wrong I do exit 1
} 2>&1 | tee test.log
但问题是,{}
块退出,而不是整个脚本。
如何让整个脚本退出?
我有以下脚本:退出整个脚本{}
{
...
many commands and printing
...
if something goes wrong I do exit 1
} 2>&1 | tee test.log
但问题是,{}
块退出,而不是整个脚本。
如何让整个脚本退出?
添加以下行的tee命令后:
test ${PIPESTATUS[0]} -eq 0 || exit ${PIPESTATUS[0]}