linux - How can you access the base filename of a file you are sourcing in Bash? -


I am putting out a file in a Bash terminal for which to export some environment varibles.

example:

  source linux_x86.env  

The env file looks a bit like this:

 < Code> Export ARCH = / home / user / project / linux_x86  

There is a bunch of different architectures for me to compile and I want to be able to do something like this:

Export ARCH = / home / user / project / `basename $ 0 ANV`

Where basename $ 0 .env I have to give the username that the above work is a banscript, but when you source the file, Does not seem to be.

Is there a way to get the same behavior from the source?

See, especially about comments about BASH_SOURCE variable.

summary: SCRIPT_NAME = $ (parent name $ {BASH_SOURCE [0]})


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -