This is an old revision of the document!


Test for existence

Synopsis

  isset <value>

Examples

Boot if a filename is specified

  isset ${filename} && chain ${filename} || goto no_filename

Set a default DNS server if none is specified

  isset ${dns} || set dns 192.168.0.1

Retry DHCP indefinitely until a filename is obtained

  #!ipxe
  :retry_dhcp
  dhcp && isset ${filename} || goto retry_dhcp

Description

Test existence of the specified value, which will normally be a configuration setting. Existence is indicated via the command status; the conditional operators && and || can be used to decide what action to take as a result.

Command status

Success The value exists
Failure The value does not exist

See also

Notes

The isset command relies upon the settings expansion performed by all iPXE commands. The implementation of the isset command simply tests to see if it has a non-empty argument.

You should always consider what will happen if the setting does not exist. For example:

  isset ${filename} && chain ${filename}

If no filename is specified then the isset command will fail and the script will terminate, as described in the scripting guide. To avoid this problem, you can use the || operator:

  isset ${filename} && chain ${filename} ||
cmd/isset.1302288490.txt.gz ยท Last modified: 2011/04/08 18:48 by mcb30
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Driven by DokuWiki
All uses of this content must include an attribution to the iPXE project and the URL https://ipxe.org
References to "iPXE" may not be altered or removed.