变量插入中断命令

Variable insertion breaks command

我想把它放在脚本中:

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

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

ipaPath=
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 选项。


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

您需要使用arrays:

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

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