Ios 如何在shell脚本中处理appcenter登录错误?

Ios 如何在shell脚本中处理appcenter登录错误?,ios,shell,terminal,visual-studio-app-center-distribute,Ios,Shell,Terminal,Visual Studio App Center Distribute,我正在使用以下脚本将ipa发布到appcenter ipaPath=<PATH TO MY IPA FILE> echo "Found ipa at $ipaPath" if [[ -z ${ipaPath} ]] then echo "No ipas were found, skip publishing to App Center" else appcenter login appcenter distr

我正在使用以下脚本将ipa发布到appcenter

ipaPath=<PATH TO MY IPA FILE>
echo "Found ipa at $ipaPath"

if [[ -z ${ipaPath} ]]

then

    echo "No ipas were found, skip publishing to App Center"

else

    appcenter login 
    appcenter distribute release \
        --group Collaborators \
        --file "${ipaPath}" \
        --release-notes 'App submission' \
        --app <username_or_organization>/<application_identifier> \
        --quiet
fi
ipaPath=
echo“在$ipaPath处找到ipa”
如果[[-z${ipaPath}]]
然后
echo“未找到IPA,跳过发布到App Center”
其他的
应用中心登录
appcenter分发版本\
--小组合作者\
--文件“${ipaPath}”\
--发布说明“应用程序提交”\
--应用程序/\
--安静的
fi
如果登录失败并且不想运行distribute命令,我需要退出。如何检查登录状态并处理错误?

您可以使用将
appcenter登录的结果捕获到变量中,然后在变量内容中搜索特定字符串(或缺少)。例如:

reply="$(appcenter login --token ${token})"

if [[ $reply == *"Error"* ]]; then
  echo "A problem occurred! ${reply}"
else
  appcenter distribute release
  ...
fi

谢谢上述解决方案工作正常,但我需要捕获appcenter登录的结果,而不使用令牌。“有什么办法可以实现吗?”巴拉穆鲁甘不知道。如果不使用
--token
选项,我无法实现对appcenter的静默登录。使用
-p
-u
选项时,会出现一个错误,表明这是一个“交互式环境”。没有任何选择,我被带到网站,并提供了令牌,所以似乎令牌是必需的。