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

RE: [microblaze-uclinux] setenv in uClinux



I thought to use alias, on my host machine it works:

alias setenv export
setenv b=100
echo $b
100

Unfortunately MSH doesn't support alias and I couldn't compile ASH for
uClinux. But major problem is that following u-boot format there is no
'=' symbol between variable and value... Should I try to compile HUSH?

Leonid.

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

Leonid wrote:
> 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:

export makes environment variables visible to *child* processes of the 
current process - not the parent process.

> 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?

In bash you can use "source"

*** ipaddr.sh ***
export ipaddr 1.2.3.4


# source ipaddr.sh
# echo $ipaddr
1.2.3.4

I'm not sure which shells support source.

Another option is to put in /etc/rc, that gets interpreted on startup 
and any environment variables placed there will be visible to the login 
shell

Finally you have the option of using temp files, in /var for example.

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/