Reputation: 1
I was curious about how the famous Bourne shell is written.So I started digging into the source code.I understand that,One of the initial things which bash does is it loads the ~/.bash_profile file for the user env. My question is how it loads the environment variables in the current shell.
In the source code bash-2.0/shell.c
, I found a function call like,
maybe_execute_file ("~/.bash_profile", 1);
Even after digging further I was unable to get the exact logic as of how the values are pushed in environment.
Upvotes: 0
Views: 146
Reputation: 122414
Neither - it executes it without forking (just like the .
or source
built in command). If it forked first then environment variable changes in the subshell wouldn't be visible in the original parent.
Upvotes: 1