[ubuntu-users] Exporting Variables

Vram lamsokvr at xprt.net
Sun Jul 10 23:46:24 UTC 2005


On Sun, 2005-07-10 at 19:17 -0400, Steve Feehan wrote:
> 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.
> 
> -- 

And if you go

echo $FOO

you get  bar..

Thanks

Vram



> Steve Feehan
> 





More information about the ubuntu-users mailing list