[ILUG] Shell programming environment vaiables
Stephen_Reilly at dell.com
Stephen_Reilly at dell.com
Wed Jan 16 18:12:43 GMT 2002
Use the commandline "<root at localhost>. ./changetest.sh" to run it
and it will work. As in dot space dot slash scriptname.
steve
-----Original Message-----
From: Waider [mailto:waider at dspsrv.com]
Sent: 03 January 2002 17:01
To: Siobhan Kelly
Cc: ilug at linux.ie
Subject: Re: [ILUG] Shell programming environment vaiables
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.
--
Irish Linux Users' Group: ilug at linux.ie
http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
List maintainer: listmaster at linux.ie
More information about the ILUG
mailing list