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?

Cyrus
  • 84,225
  • 14
  • 89
  • 153
Pavel Zagalsky
  • 1,620
  • 7
  • 22
  • 52
  • This is the [difference between single and double quotes](http://stackoverflow.com/questions/6697753/difference-between-single-and-double-quotes-in-bash). – Etan Reisner Dec 27 '15 at 22:50

1 Answers1

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
stek29
  • 395
  • 4
  • 14