isset <value>
isset ${filename} && chain ${filename} || goto no_filename
isset ${dns} || set dns 192.168.0.1
#!ipxe
:retry_dhcp
dhcp && isset ${filename} || goto retry_dhcp
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.
| Success | The value exists |
|---|---|
| Failure | The value does not exist |
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} ||