shell 脚本中的$?

shell 脚本中的$?

shell 脚本中的

$?

表示显示最后命令的退出状态。0表示没有错误,其他任何值表明有错误。
这可以用来用作流程控制,例如:

if [[ "$?" -ne 0 ]]; then
#处理代码
fi
发布了97 篇原创文章 · 获赞 55 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/voidfaceless/article/details/103010342
今日推荐