Difference between (bash) shell variables which are exported and those which are not
57
votes
1
answer
29891
views
Bash seems to differentiate between variables which are exported and those which are not.
example:
$ FOO=BAR
$ set | grep FOO
FOO=BAR
$ env | grep FOO
set
sees the variable but env
does not.
$ export BAR=FOO
$ set | grep FOO
BAR=FOO
FOO=BAR
$ env | grep FOO
BAR=FOO
set
sees both variables but env
sees only the exported variable.
I know that set
is a bash builtin and env
is not.
What are the differences between variables which are exported and those which are not?
Asked by Lesmana
(28027 rep)
Oct 25, 2010, 10:15 PM
Last activity: May 21, 2025, 09:44 AM
Last activity: May 21, 2025, 09:44 AM