[root@test output]# cat a.sh
#!/bin/sh
a=3
if [ $a -gt 4 ]
then
echo "1111111"
exit 1
fi
echo "222222"
exit 0
[root@test output]# cat b.sh
#!/bin/sh
sh a.sh | tee >>a.log
aa=${PIPESTATUS[0]}
if [ $aa -ne 0 ]
then
echo "aaaaaaaaaaaaaaaa"
fi
管道和tee使用时获取前面命令返回值
猜你喜欢
转载自gumuzhiyu.iteye.com/blog/2423495
今日推荐
周排行