变量插入中断命令

时间:2016-12-28 21:18:03

标签: bash macos fastlane

我想把它放在一个脚本中:

fastlane sigh resign test.ipa --signing_identity "iPhone Distribution: test KGaA" --provisioning_profile Dist_InHouse_test_All_Wildcard.mobileprovision

我如何将它放入我的脚本中:

ipaPath=$1
signingIdentity="--signing_identity \"iPhone Distribution: test KGaA\""
provisioningProfileFile="Dist_InHouse_test_All_Wildcard.mobileprovision"

fastlane sigh resign ${ipaPath} ${signingIdentity} ${provisioningProfile}

这打破了命令。显然,${signingIdentity}变量仅包含--signing_identity

[22:07:22]: Couldn't find signing identity ''.

我试过双引号:

fastlane sigh resign ${ipaPath} "${signingIdentity}" ${provisioningProfile}

但是产生了:

invalid option: --signing_identity "iPhone Distribution: test KGaA"

显然这是一个有效的选择。

我试过单引号:

fastlane sigh resign ${ipaPath} '${signingIdentity}' ${provisioningProfile}

但这导致我根本没有--signing_identity选项。

知道这里出了什么问题吗?

1 个答案:

答案 0 :(得分:2)

您需要使用 arrays

ipaPath=$1
signingIdentity=( --signing_identity "iPhone Distribution: test KGaA" )
provisioningProfileFile=( --provisioning_profile "Dist_InHouse_test_All_Wildcard.mobileprovision" )

fastlane sigh resign "${ipaPath}" "${signingIdentity[@]}" "${provisioningProfile[@]}"