Right click on the specific target in XCODE
You can enter your shell script like this, here is a sample script to list available variables.
Build and Run and come open build results to see your script results.
Xcode 4 build setting variables for scheme scripts
转自:http://stackoverflow.com/questions/5319989/xcode-4-build-setting-variables-for-scheme-scripts
Apart from that, if you select "None", there will be a bunch of environment variables set by Xcode. You can discover all of them by doing something like printenv > ~/Desktop/printenv.txt
to have them dumped to a text file.
Some of the more useful environment variables include ARCHIVE_PATH
, SCHEME_NAME
, USER
,ARCHIVE_DSYMS_PATH
, ARCHIVE_PRODUCTS_PATH
.
参考说明
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcrun.1.html
shell的官方参考网页
https://developer.apple.com/library/mac/#documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004268-TP40003516