[ipxe-devel] inc command - iterating with characters?

Michael Brown mbrown at fensystems.co.uk
Fri Aug 2 11:45:35 UTC 2013


> On 02.08.2013 11:27, Christian Hesse wrote:
>> just saw the last commit about inc command... Really great work!

Thanks!

>> Now I think about a dynamically generated menu that automatically
>> increments
>> the key shortcuts. However I do have a menu that has more than ten
>> entries, so iterating with characters (e. g. 1, 2, ..., 9, a, b, ...)
>> would
>> be a great feature. Is there a way to do that already?
>> Any chance to get that implemented?
>
> iPXE> set x:uint8 65
> iPXE> show x:string
> x:string = A
> iPXE> echo ${x:string}
> A

The "item --key <key>" option accepts either single-character literals
(e.g. "1") or numeric ASCII values (e.g. "97" for "a").  You could
therefore do something like:

set shortcut:string 1
:loop
  item --key ${shortcut} .....
  iseq ${shortcut:string} 9 && set shortcut:string a || inc shortcut:int8
goto loop

Michael




More information about the ipxe-devel mailing list