[PATCH] RFC: nvedit: support doing one (extra) expansion of the value in "env set"
Wolfgang Denk
wd at denx.de
Sun Feb 16 18:25:31 CET 2020
Dear Rasmus,
In message <20200216152427.E80C7240036 at gemini.denx.de> I wrote:
>
> So lets change my little script to add setting "left":
>
> slot=none
> for i in $BOOT_ORDER ; do
> setenv tmp_cmd 'setexpr tmp_val sub '^' "" $'BOOT_${i}_LEFT
> run tmp_cmd
> test $slot = none && test $tmp_val -gt 0 && slot=$i && left=$tmp_val
> done
> echo "## Chosen Slot = $slot ; Left = $left"
>
> Result:
>
> ## Chosen Slot = C ; Left = 2
Actually I'm stupid. It's much easier this way, and without the
ugly printed messages:
setenv BOOT_ORDER A B C D
setenv BOOT_A_LEFT 0
setenv BOOT_B_LEFT 0
setenv BOOT_C_LEFT 2
setenv BOOT_D_LEFT 5
slot=none
for i in $BOOT_ORDER ; do
setenv tmp_cmd 'setenv tmp_val $'BOOT_${i}_LEFT
run tmp_cmd
test $slot = none && test $tmp_val -gt 0 && slot=$i && left=$tmp_val
done
echo "## Chosen Slot = $slot ; Left = $left"
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: wd at denx.de
A modem is a baudy house.
More information about the U-Boot
mailing list