What is export
for?
What is the difference between:
export name=value
and
name=value
The accepted answer implies this, but I'd like to make explicit the connection to shell builtins:
As mentioned already, export
will make a variable available to both the shell and children. If export
is not used, the variable will only be available in the shell, and only shell builtins can access it.
That is,
tango=3
env | grep tango # prints nothing, since env is a child process
set | grep tango # prints tango=3 - "type set" shows `set` is a shell builtin