Dear Clément Péron,
In message <cajiuccfnutbynhbs+9wgg00glskvoqbi6ehk9aj1+il5onj...@mail.gmail.com>
you wrote:
>
> I write a script on u-boot but i found 2 strange behaviors.
I'm tempted to rephrase: you made some errors :-)
> The first one is when I try to do a mask from a memory address and
> store it to an env variable.
>
> => setexpr toto *{loadaddr} & 0xFF
> syntax error
> => setexpr toto *{loadaddr} & 0x3F
> syntax error
> => setexpr toto 0x3F & *{loadaddr}
> syntax error
This has nothing to dowith the setexpr command - the error message
comes from the shell. It will issue the same error for other uses
of an (unmasked) ampersand:
-> echo a & echo b
syntax error
Note: you must always escape special characters.
Also, you probably want to write ${loadaddr} (mind the dollar
character).
So try:
setexpr toto *${loadaddr} '&' 0xFF
> The second one is the difference between '==' and '-eq'
>
> => setenv a 1
> => setenv b 2
> => if test ${a} -eq ${b}; then echo toto; fi;
> => if test ${a} == ${b}; then echo toto; fi;
> toto
>
> Which doesn't seem logic.
Well, did you read the man page for the test command?
== is operating on STRING arguments, while -eq is operating on
INTEGER arguments. So depending on the content of your variables
the result may be the same or different.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
COBOL is for morons. -- E.W. Dijkstra
_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot