Does bash import variables from inner file at second and deeper levels? -


i have these files:

# ~/.bashrc   # expect variables in file exported  . ~/env_vars.sh 
# ~/env_vars.sh  # expect expands parent's vars export var=test 

what happens when run bash:

$ echo $var $ 

nothing.

but when place variables directly in .bashrc

# ~/.bashrc var=test 

then works:

$ echo $var test 

is possible import variables inner files?

about versions:

bash --version gnu bash, version 4.4.12(1)-release (x86_64-unknown-linux-gnu)  $ uname -a linux user-pc 4.9.38-1-manjaro #1 smp preempt sat jul 15 12:04:06 utc 2017 x86_64 gnu/linux 

i know ~ works , ~/env_vars.sh have sourced:

# ~/env_vars.sh touch ~/env_sourced.test 
$ bash $ file ~/env_sourced.test ~/env_sourced.test: empty 


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -