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

You should always consider what will happen if the value 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.txt ยท Last modified: 2011/04/08 18:49 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 http://ipxe.org
References to "iPXE" may not be altered or removed.