之前每次看U-Boot的环境变量,里面经常有if、while、for,就当Linux Shell脚本来用,也没去找文档看看。
/**********************************************************************
* U-Boot shell脚本语法
* 说明:
* 之前每次看U-Boot的环境变量,里面经常有if、while、for,就当Linux
* Shell脚本来用,也没去找文档看看。
*
* 2018-7-16 深圳 宝安西乡 曾剑锋
*********************************************************************/
一、参考文档:
1. U-Boot Scripts
http://www.compulab.co.il/utilite-computer/wiki/index.php/U-Boot_Scripts
2. 14.2.17. How the Command Line Parsing Works
http://www.denx.de/wiki/view/DULG/CommandLineParsing#Section_14.2.17.
二、主要条件流控语法:
1. if <condition>; then <command list>; [ elif <condition>; then <command list>; ] ... [ else <command list>; ] fi
2. while <condition>> ; do <command list> ; done
3. until <condition> ; do <command list> ; done
4. for <name> in <word list> ; do <command list> ; done