开发者

Running shell script without environment variables in Xcode?

Xcode sets variety of environment variables relate开发者_如何学编程d build when running shell script. Is there a way to running shell script without setting of those variables?


I got a solution. Use this method in Run Script Phase target phase: https://serverfault.com/questions/176966/how-to-continue-execution-of-shell-script-after-calling-other-shell-script-with/176976#176976

These shell commands run following command ignoring variables in current environment.

env -i <command>
exec -c <command>

As an example, I used this script:

env -i ./makeall.sh

This disables all of Xcode's predefined variables, so script does not affected by Xcode configuration, but it's also less useful because we cannot use Xcode paths related build.

So, however, you can pass specific Xcode variable like this script.

build()
{
    # Don't know why, however, the environment variable passed to external script even with "env -i".
    env -i ./makeall.sh "${SYMROOT}"
}

build
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜