LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Shell programming environment vaiables

[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
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell