If you are using goto to jump to a label when an operation succeeds, then you must also consider what would happen if the operation were to fail. For example:

dhcp && goto dhcp_ok

If the dhcp command fails, then the script will immediately terminate, as described in the scripting guide. To avoid this problem, you can use the || operator:

dhcp && goto dhcp_ok ||

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: