I can't figure it out. It is argued that the source command is equivalent to ./ But this is not the case. There is a var file. There are only two lines:

 #!/bin/bash export PATH=/home/cj/openwrt/staging_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin:$PATH 

Now I execute this file: First ./var Then source var

And here is the result: enter image description here

Here you can clearly see that from ./var environment variables do not change.

But from source var , the PATH variable is changed and preserved.

That is, these are not equivalent commands?

What other ways is there to change the variables for the whole environment?

1 answer 1

The source ./var.sh equivalent to the command . ./var.sh . ./var.sh (note the dot before the ./var.sh ).

  • Now I get it! Thank! - CJ1 pm