I wonder if there is a need to use "export" when setting a variable in .bashrc.
In my tests editing .bashrc there was no difference between
foo=bar
and
export foo=bar
In both cases, after login "echo $foo" outputs "bar".
I am using Debian Squeeze, if that matters.
Thank you guys in advance.
Try creating a shell script that accesses the foo
variable.
If foo
was export
'ed, it will be visible in the shell script, otherwise it won't.
SuperUser has this covered.
Short answer: export
makes sure the environment variable is set in child processes. If you don't export, it's only available in the same process/interactive session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With