This is an old revision of the document!
goto <label>
:loop echo Hello world goto loop
goto host_${hostname} || goto unknown
Jump to a script label. This command can be used only within an iPXE script.
Failure | The label does not exist |
---|
It is logically impossible for this command to return successfully.
As with all iPXE commands, any settings such as ${hostname} will be expanded. It is therefore possible to use a dynamically-generated label as the target for the goto
command. For example, if the hostname provided by DHCP is thinclient1
, then the command
goto host_${hostname}
would jump to the label host_thinclient1
.
When using dynamically-generated labels, it is generally a good idea to include a fallback label in case the dynamically-generated label does not exist. For example:
#!ipxe dhcp goto host_${hostname} || goto unknown :host_thinclient1 sanboot iscsi:192.168.0.1::::iqn.2010-04.org.ipxe:winxp :host_thinclient2 sanboot iscsi:192.168.0.1::::iqn.2010-04.org.ipxe:win7 :unknown echo Unknown host ${hostname}