
Hi:
In the http://www.denx.de/wiki/view/DULG/CommandLineParsing, chapter 14.2.11.2, bullet 3 from the top says:
" In the current implementation, the local variables space and global environment variables space are separated. Local variables are those you define by simply typing like name=value. To access a local variable later on, you have to write '$name' or '${name}'; to execute the contents of a variable directly you can type '$name' at the command prompt."
...which implies that local variables can be used to save commands and execute them later. It doesn't contradict with the statement in previous bullet that
"... only environment variables can be used with run command"
since it merely states that "run <command>" format is invalid for local variables, not that their execution itself is impossible.
Using local variables I could run some scripts indeed:
U-Boot$ scr='echo Hello World' U-Boot$ $scr Hello World U-Boot$
U-Boot$ scr='a=100 b=200' U-Boot$ $scr U-Boot$ echo a=$a b=$b a=100 b=200 U-Boot$
However it doesn't work for more complicated scripts:
U-Boot$ scr='for ii in 1 2 3; do echo ii=$ii; done;' U-Boot$ $scr Unknown command 'for' - try 'help' U-Boot$
Same command, assigned using setenv is working:
U-Boot$ setenv sscr 'for ii in 1 2 3; do echo ii=$ii; done;' U-Boot$ run sscr ii=1 ii=2 ii=3 U-Boot$
Am I doing something wrong? U-boot version is 1.2.0 (official release, not top of the git tree).
Thanks,
Leonid.