开发者

$SRCROOT not recognized in shell script attached to XCode project

Trying to run a simple script attached to my xcode project as follows...

if [ -d '$HOME/data' ]; 
then
  cd "$HOME/data/"
  rsync -t *.plist '$SRCROOT/data/'
fi

exit 0

The script seems to run fine if I run it outside of XCode but when running from XCode I'm getting the following error...

line 2: SRCROOT: command not found

Seems the SRCROOT variable isn't detectable in the script but my understanding was that this is one of the environment variables that should be passed and accessible to th开发者_如何转开发e script. Any thought?


Turns out this was my fault. The script was actually not being called at all. In XCode I was referring to the path of the script using...

"./$(SRCROOT)/myScript.sh"

Switching it to...

"$SRCROOT/myScript.sh"

Corrected the problem and indeed I can access $SRCROOT from my script now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜