[U-Boot] u-boot script "test"

Wolfgang Denk wd at denx.de
Tue Jan 24 11:43:05 CET 2012


Dear Sridhar Addagada,

In message <1327396047.99588.YahooMailNeo at web120201.mail.ne1.yahoo.com> you wrote:
>
> What is the behavior of test command when the variable is not present in the uboot env

It should be the same as in any other bourne compatible shell.

> set x

Note that "set" for "setenv" may or may not work, depending on your
command selection.

> if test $x = 1; then echo "Yes"; else echo "No"; fi

This should provoke an error from the "test" command which misses an
argument.

> in the above case I get Yes echoed back.

That's a bug then.  Patches welcome...

> Is there any way to test the presence of a variable in uboot script?

This should be possible like in any other shell...



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Alan Turing thought about criteria to settle the question of  whether
machines  can think, a question of which we now know that it is about
as relevant as the question of whether submarines can swim.
                                                   -- Edsger Dijkstra


More information about the U-Boot mailing list