Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$SRCROOT not recognized in shell script attached to XCode project

Tags:

shell

xcode

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 the script. Any thought?

like image 720
Rob Segal Avatar asked Sep 01 '11 03:09

Rob Segal


1 Answers

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.

like image 172
Rob Segal Avatar answered Nov 12 '22 14:11

Rob Segal