0

I have an iOS Build command on Mac and I want to create a script that will receive arguments like iOS version, Device etc and run a build with it. For some reason I am unable to pass the arguments successfully from the cmd to the script itself. Here's the script:

#!/usr/bin/env node
DEVICENAME="iPhone 5s"
OS="9"
xcodebuild -scheme MyScheme -destination 'platform=iOS Simulator,name=iPhone 5s,OS=9.2' -project /Users/etc/etc/Application.xcodeproj

I tried substituting like this:

xcodebuild -scheme MyScheme -destination 'platform=iOS Simulator,name=$DEVICENAME,OS=$OS' -project /Users/etc/etc/Application.xcodeproj

And like this:

xcodebuild -scheme MyScheme -destination 'platform=iOS Simulator,name=${DEVICENAME},OS=${OS}' -project /Users/etc/etc/Application.xcodeproj

Neither works and I can't seem to find a fix online. Anybody knows what should I do here?

1

1 Answer 1

2

Bash doesn't put variables in single quotes, so it should be:

xcodebuild -scheme MyScheme -destination "platform=iOS Simulator,name=$DEVICENAME,OS=$OS" -project /Users/etc/etc/Application.xcodeproj
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! I'll try this once I'm near my computer
When I run the command in the Mac shell I run it with single quotes. Will it work with double quotes as well?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.