unix shell脚本子进程结果
我正在尝试获取子进程的结果。但目前我能得到的唯一结果是日志字符串。 我想测试整数结果,但我不知道如何。
buildresult=$(xcodebuild -project $projectfile -nodistribute -activetarget -sdk macosx10.5 "PRODUCT_VERSION_NUM=$PRODUCT_VERSION" 'MACOSX_DEPLOYMENT_TARGET=10.4' 'ARCHS=$(ARCHS_STANDARD_32_BIT)' 'DEMO_PREPROCESSOR_FLAG=_FLUX_DEMO_' "PRODUCT_NAME=$PRODUCTS_ITEM-Demo" 'BASEPRODUCT_NAME=null' -configuration Release build)
$buildresult包含echo日志,如何测试结果?
谢谢。
i'm trying to get the result of a sub process. But for now the only result i can have is the log string.
I would like to test the integer result but i don't know how.
buildresult=$(xcodebuild -project $projectfile -nodistribute -activetarget -sdk macosx10.5 "PRODUCT_VERSION_NUM=$PRODUCT_VERSION" 'MACOSX_DEPLOYMENT_TARGET=10.4' 'ARCHS=$(ARCHS_STANDARD_32_BIT)' 'DEMO_PREPROCESSOR_FLAG=_FLUX_DEMO_' "PRODUCT_NAME=$PRODUCTS_ITEM-Demo" 'BASEPRODUCT_NAME=null' -configuration Release build)
$buildresult contain the echo log, how to test the result ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
子进程的退出状态可在 $?多变的:
The exit status of a subprocess is available in the $? variable:
或者
or
使用$?查找最后一个命令的返回码。这假设该命令返回一个有意义的返回代码。
Use $? to find the return code of the last command. This assumes that the command returns a meaningful return code.