[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: export won't work



On Sun, 01 Sep 2002 19:04:07 +1000
Russell <rjshaw@iprimus.com.au> wrote:
> Why won't export work? When i run this
> bash script on debian 3:
> 
> #!/bin/sh
> ABC=def
> export ABC
> exit 0
> 
> when i type 'export', then ABC doesn't
> appear in the list of environment variables.

That's unsurprising.

Environment variables are passed to _children_, not parents. So when you
run that script, it creates an environment variable ABC, then exits.
It's got no children at all :)

I think what you want, is to source the file.

'source /path/to/script'. That'll load it in the current
environment/process. Of course, with that 'exit 0' there, it'll also
exit you from your shell ;) Might want to get rid of it.

Attachment: pgpG_YlAzFXFB.pgp
Description: PGP signature


Reply to: