[U-Boot-Users] u-boot HUSH scripting using local variables.

Wolfgang Denk wd at denx.de
Tue May 15 19:16:55 CEST 2007

In message <406A31B117F2734987636D6CCC93EE3C017B9ECF at ehost011-3.exch011.intermedia.net> you wrote:
> " 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 

I don't see how you derive that. The  text  above  does  not  mention
commands or execution.

> "... only environment variables can be used with run  command"

Now this is prtrry clear, I think.

> since it merely states that "run <command>" format is invalid for local
> variables, not that their execution itself is impossible.

This is your interpretation, and it is wrong.

"Only environment variables can be used with the ``run'' command" means,
that that cannot use local variables as arguments to the run command.

> 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

Yes, only "run" will correctly run command sequences.

> Am I doing something wrong? U-boot version is 1.2.0 (official release,
> not top of the git tree).

Yes, you are doing something wrong. So  (somewhat  intentionally,  it
seems) misinterpret the documentation.

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
I can't understand it. I can't even understand  the  people  who  can
understand it.                    - Queen Juliana of the Netherlands.

More information about the U-Boot mailing list