[U-Boot] set and test a local variable in a script

Andreas Neubacher a_neubi at gmx.at
Sat Nov 22 19:23:08 CET 2014


hi,

i'm trying to set a local variable and test the variable in an 
if-then-else script ...
but it's somehow a bit weird!?

- set variable "nea" to 0
- create a script "x" and run .... OK
- modify variable "nea" to 1
- run script "x" again ... NOK?!

... what i'm doing wrong  -  the behavior is the same with 2013.10 and 
2014.01



 >U-Boot# nea=0
 >U-Boot# setenv x "if itest 1 -eq $nea; then echo var1; else echo var0; 
fi;"
 >U-Boot# run x
 >var0
 >U-Boot# nea=1
 >U-Boot# run x
 >var0            <<<<<----- so now i should get the "var1" as a result
 >U-Boot# echo $nea
 >1

 >U-Boot# setenv x "if itest 1 -eq $nea; then echo var1; else echo var0; 
fi;"
 >U-Boot# run x
 >var1          <<<<<------- after i set the script "x" again it's 
working ... ?!


br & thx for any hint,
Andy


More information about the U-Boot mailing list