shell中如何在父进程中获取子进程命令的返回码
写了个clearcase的check out/check in脚本:
--------------------------------------
fun=$1
......
cleartool setview $userbranch << !
if [ ${fun} == "co" ]
then
# Check out source code.
echo "." | cleartool ${fun} ${filename}
if [ xxxx ]
then
else
fi
fi
......
------------------------------------
cleartool setview $userbranch 这一句中,cleartool会启动一个新进程,所以用了输入重定向。
我要在if [ xxxx ]这句中判断echo "." | cleartool ${fun} ${filename}这句命令的返回码,如何能做到
试过$?,没用,因为是子进程的返回码。