Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I execute a remote script as a build phase in xcode?

Tags:

bash

shell

xcode

I have a remote script which I can execute from command line without an issue:

bash <(curl -sSL 'goo.gl/p1GPQw') 29165BE4-EA61-8228-9F33-A9B9DAD481A0 ./Info.plist

Problem comes when I try to use it in as a build phase of my iOS app (to update a build number).

The error log:

/Users/pr.......: line 2: syntax error near unexpected token `('
/Users/pr.......: line 2: `bash <(curl -sSL 'goo.gl/p1GPQw') 7CD17FC7-E724-7240-34ED-927122733119 ./Info.plist'

So the question is, are there any limitations in what you can through xcode execute or is it some error in syntax?

Update: If I change the /bin/sh to /bin/bash, it works ... so the updated question is, what is the /bin/sh equivalent of bash <(curl -sSL 'goo.gl/p1GPQw') 29165BE4-EA61-8228-9F33-A9B9DAD481A0 ./Info.plist as making users change this is another complication that can make the entire thing go sideways.

like image 571
Ondrej Rafaj Avatar asked Feb 21 '26 20:02

Ondrej Rafaj


1 Answers

I tried to simplify the problem, for purpose of reproducibility:

This is 1.sh script:

#!/usr/bin/bash
echo echo Hello World
echo echo Today : $(date)

When run in /bin/bash, it works fine:

bash $ bash <(./1.sh)
Hello World
Today : Thu, Sep 22, 2016 2:32:19 AM
$

When run in /bin/sh it gives an error:

sh $ bash <(./1.sh)
sh: syntax error near unexpected token `('
sh $

But, the following should work fine even in /bin/sh:

sh $ bash -c "bash <(./1.sh)"
Hello World
Today : Thu, Sep 22, 2016 2:35:35 AM
sh $
like image 195
blackpen Avatar answered Feb 23 '26 20:02

blackpen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!