What Does the Command "Pwd=/Proc/Self/Cwd Another_Executable " Mean?

What Does the Command "Pwd=/Proc/Self/Cwd Another_Executable " Mean?

When building AOSP 9.0.0_r30 source with these commands:

$ make clean
$ make showcommands -j8 > ~/BuildAndroid.txt

there are commands line like this in ~/BuildAndoird.txt:

[ 58% 62374/106553] PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++ ........

I suppose this is a bash command,but why there is "PWD=/proc/self/cwd" and a space(not ; or &&) before "prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++"?What does this mean,I don't think it is legal for bash because space means the following text are parameters instead of command.

Another problem is,what is "/proc/self/cwd",is that a standard proc node?

Some experiment:

$ VAR=123
$ VAR=456 echo $VAR
 123
$ echo $VAR
 123

So this is really legal,but what is the meaning?

0

2 Answers

It executes the command

prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++

but when setting up the environment for this command, it sets the environment variable PWD to the value /proc/self/cwd. Note that this affects only the environment of the clang++ process, not the environment/variable space of the shell script.

5

Try again:

VAR=123
VAR=456 echo $VAR
123

Ok, but:

VAR=456 /bin/sh -c 'echo $VAR'
456
Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.