[ubuntu-users] Exporting Variables

Steve Feehan sfeehan at sbb.uvm.edu
Sun Jul 10 23:17:00 UTC 2005


On Sun, Jul 10, 2005 at 07:09:15PM -0400, Matthew S-H wrote:
> What exactly is the purpose of "exporting" a variable?

Setting a variable:

  $ FOO=bar

Only affects the current shell. If you type printenv, the
variable won't be set since it's not "exported" to child
processes:

  $ printenv | grep FOO

But:

  $ export FOO

Now FOO is exported to child processes, so it will show up
in the output of printenv:

  $ printenv | grep FOO
  FOO=bar

Hope that helps.

-- 
Steve Feehan




More information about the ubuntu-users mailing list