[ILUG] Shell programming environment vaiables
Waider
waider at dspsrv.com
Thu Jan 3 16:47:09 GMT 2002
According to Siobhan Kelly:
> Anybody explain what's going on here???
>
> <root at localhost>env | grep SHELL
> <root at localhost>SHELL=/bin/bash
> <root at localhost>TEST=set
> <root at localhost>export TEST
> <root at localhost>echo %TEST
> <root at localhost>set
> <root at localhost>./changetest.sh
> <root at localhost>unset
> <root at localhost>echo %TEST
> <root at localhost>set
>
> #!/bin/bash
> #changetest.sh
> TEST=unset
> export TEST
> echo $TEST
>
>
> I can't seen to set any environment variable from my
> shell progs.
1. If you're on Unix, $foo is the variable value, not %foo
2. If you're not aware of 1, you shouldn't really be experimenting as root
3. You can't set a variable from a subprocess. You CAN set a variable by
sourcing the file, using source (csh/bash) or . (sh/bash) followed by the
filename
4. repeat line 2, except replace 1 with 3.
Cheers,
Waider.
--
waider at dspsrv.com / Chances are I'm not at home right now.
More information about the ILUG
mailing list