[U-Boot-Users] Best way to see if a u-boot environment variable is defined with a script?

Wolfgang Denk wd at denx.de
Mon Nov 20 22:49:48 CET 2006


In message <e0590900611200816v4680b57g1121aa6b4054ff88 at mail.gmail.com> you wrote:
> What would be the best way to see if a u-boot variable is defined with
> a script? In other words, I want to check to see if an env variable,
> say 'testvar' is defined from u-boot script (not from the interactive
> command line.) I tried to use itest and printenv, but doesn't seem to
> work.

First: it makes zero difference if a variable gets defined by a script
or interactively of by calling the setenv() function in some code.

Second, I cannot uunderstand why you say that printenv does not  work
for you. See here:

=> if printenv foo ; then echo variable foo found ; else echo variable foo NOT found ; fi
## Error: "foo" not defined
variable foo NOT found
=> setenv foo bar
=> if printenv foo ; then echo variable foo found ; else echo variable foo NOT found ; fi
foo=bar
variable foo found

What exactly is your problem?

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Live long and prosper.
	-- Spock, "Amok Time", stardate 3372.7




More information about the U-Boot mailing list