Variable insertion breaks command

107 views Asked by At

I want to put this in a script:

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

How I put it into my script:

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

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

This breaks the command. Apparently the ${signingIdentity} variable consists only of --signing_identity.

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

I've tried double quotes:

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

but that yields:

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

Obviously that is a valid option.


I've tried single quotes:

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

but that yields that I do not have the --signing_identity option at all.


Any idea what is going wrong here?

1

There are 1 answers

0
gniourf_gniourf On BEST ANSWER

You need to use 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[@]}"