[ipxe-devel] iPXE scripting enhancements

Michael Brown mcb30 at ipxe.org
Mon Nov 22 21:56:57 UTC 2010


Several scripting improvements are now present.  Scripts can contain labels 
and "goto", multi-layer variable expansion works as expected, and the "isset" 
command allows for trivial conditional tests.  For example:

  set i 0
  echo ${net${i}/ip}  # Will show ${net0/ip}

  goto :label

  isset ${net0/ip} || dhcp net0

This is the last set of major improvements I'm planning to make to scripting.  
I don't want it to become a general-purpose language, but I do appreciate that 
there are many use cases where having this kind of enhanced functionality is 
useful, particularly in embedded scripts.

We've been discussing in IRC whether the "isset" command ought to have a 
different name.  Options proposed are:

  isset ${foo}

  defined ${foo}

  ? ${foo}

The third option has the advantage of being usable as a left-hand comment 
marker, e.g.

  ? This is a comment && echo This is a real command

Voting is open for the next 24 hours, after which the command name shall be 
frozen in perpetuity!  Let me know which you prefer.

Michael



More information about the ipxe-devel mailing list