I want to clarify a confusion I am having in shell variable vs environment variable. I did the following test, where I have a shell variable abc and export it to an environment variable.
$
$ abc="shell var"
$ env | grep abc
$ echo $abc
shell var
$ export abc="env var"
$ env | grep abc
abc=env var
$ echo $abc
env var
$ unset abc
$ env | grep abc
$ echo $abc
$
After the export is done, I try to echo $abc.
Questions:
Does export move the variable
abcfrom shell to the environment OR does it create a copy in the environment and assign it a new value ?When the second
echois done after theexport, doesechocheck ifabcis in environment and then print it, OR hasabcbeen completely removed from the shell and is only present in the environment which is whyechoprints its value ?