[U-Boot] [U-boot] shell script syntax

Hi, experts:
It seems u-boot script does not support "for / goto" etc syntax?
So, I could not use script to let one cmd run many times?
Best wishes,

Hi TigerLiu@viatech.com.cn,
On Mon, 22 Jul 2013 17:46:38 +0800, TigerLiu@viatech.com.cn wrote:
Hi, experts:
It seems u-boot script does not support "for / goto" etc syntax?
So, I could not use script to let one cmd run many times?
See the Denx U-Boot documentation, more precisely:
http://www.denx.de/wiki/view/DULG/CommandLineParsing#Section_14.2.17.
Best wishes,
Amicalement,

Hi, Albert:
See the Denx U-Boot documentation, more precisely: http://www.denx.de/wiki/view/DULG/CommandLineParsing#Section_14.2.17. From this web page, it seems hush-shell support "for" iteration.
So, i wrote a simple script as below: for(i=1;i<10;i++) do echo "lion-0722" done
Then, i used mkimage tool to produce a script. Then, i load it to dram, and run it with autoscr cmd. But failed, the log message is: LION # fatload mmc 0:1 0 scriptcmd0722 reading scriptcmd0722 120 bytes read LION # autoscr 0 ## Executing script at 00000000 Unknown command 'for(i=1' - try 'help' Unknown command 'i<10' - try 'help' Unknown command 'i++)' - try 'help' syntax error syntax error ... ...
Best wishes,

Hi TigerLiu@viatech.com.cn,
On Mon, 22 Jul 2013 19:06:33 +0800, TigerLiu@viatech.com.cn wrote:
Hi, Albert:
See the Denx U-Boot documentation, more precisely: http://www.denx.de/wiki/view/DULG/CommandLineParsing#Section_14.2.17.
From this web page, it seems hush-shell support "for" iteration. So, i wrote a simple script as below: for(i=1;i<10;i++) do echo "lion-0722" done
Then, i used mkimage tool to produce a script. Then, i load it to dram, and run it with autoscr cmd. But failed, the log message is: LION # fatload mmc 0:1 0 scriptcmd0722 reading scriptcmd0722 120 bytes read LION # autoscr 0 ## Executing script at 00000000 Unknown command 'for(i=1' - try 'help' Unknown command 'i<10' - try 'help' Unknown command 'i++)' - try 'help' syntax error syntax error ... ...
Did you try the commands live in your U-Boot console?
Did you make sure hush shell is enabled in your U-boot?
Best wishes,
Amicalement,

Hi TigerLiu@viatech.com.cn,
On Mon, 22 Jul 2013 19:44:18 +0800, TigerLiu@viatech.com.cn wrote:
Hi, Albert:
Did you try the commands live in your U-Boot console? Did you make sure hush shell is enabled in your U-boot?
I am sure I have enabled hush shell.
I think "for" iteration syntax is error: "for(i=1;i<10;i++)"
But I don't know how to write it correctly!
This is why I suggested that you experiment in your U-Boot console, where you can quickly try things. One thing I'd test first is whether your C-like use of 'for' is valid at all for Hush, or for Bourne shell (from which Hush derives IIUC) -- I suspect it might not be.
Best wishes,
Amicalement,

Try something like
=> for i in a b c; do
echo $i done
a b c =>
Regards, Jim
On 07/22/2013 04:44 AM, TigerLiu@viatech.com.cn wrote:
Hi, Albert:
Did you try the commands live in your U-Boot console? Did you make sure hush shell is enabled in your U-boot?
I am sure I have enabled hush shell.
I think "for" iteration syntax is error: "for(i=1;i<10;i++)"
But I don't know how to write it correctly!
Best wishes, _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
participants (3)
-
Albert ARIBAUD
-
James Chargin
-
TigerLiu@viatech.com.cn