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

RE: [microblaze-uclinux] setenv in uClinux



I basically want to be able to run u-boot HUSH script in the Linux
shell. U-boot has "setenv" commands with effect, similar to that of bash
"export" - it defines global variables, visible from everywhere:

setenv ipaddr 1.2.3.4
echo $ipaddr
1.2.3.4

I thought I'll write small application "setenv" which will be setting
environment variables... Do you have a better idea?

Thanks,

Leonid.

-----Original Message-----
From: owner-microblaze-uclinux@xxxxxxxxxxxxxx
[mailto:owner-microblaze-uclinux@xxxxxxxxxxxxxx] On Behalf Of John
Williams
Sent: Thursday, May 24, 2007 7:25 PM
To: microblaze-uclinux@xxxxxxxxxxxxxx
Subject: Re: [microblaze-uclinux] setenv in uClinux

Leonid wrote:
> Does anybody know a way to set shell environment variable from user
> application? Simple setenv() call does the trick, but value disappears
> as soon as application quits.

I'd be happy to be proven wrong, but AFAIK it can't be done - a child 
process cannot modify the environment of its parent (the shell in this 
case).  It would be a security nightmare for starters.

BTW this is why the petalinux settings.sh script has to be sourced, and 
not executed, because we need to set the PETALINUX environment variable.

What are you tryiung to achieve?  Chances are there's a better way

Regards,

John


___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive :
http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/


___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/