Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cmd:iseq [2011/04/08 18:53] (current)
mcb30 created
Line 1: Line 1:
 +====== Test for equality ======
 +
 +===== Synopsis =====
 +
 +    iseq <​value1>​ <​value2>​
 +
 +===== Examples =====
 +
 +=== Prompt user to confirm IP configuration ===
 +    echo IP configuration:​
 +    route
 +    echo -n Is this correct? (y/n) ${} && read answer
 +    iseq ${answer} Y && goto is_correct ||
 +    iseq ${answer} y && goto is_correct ||
 +    goto retry
 +
 +===== Description =====
 +
 +Test equality of the two specified values, at least one of which will normally be a configuration [[:​settings|setting]]. ​ Equality 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 values are equal          |
 +^ Failure ​  | The values are not equal      |
 +
 +===== See also =====
 +
 +  * ''​[[:​cmd:​isset]]''​
 +  * ''​[[:​cmd:​set]]''​
 +  * ''​[[:​cmd:​show]]''​
 +  * ''​[[:​cmd:​goto]]''​
 +  * iPXE [[:​scripting|scripting]] guide
 +  * [[:cmd|List of all iPXE commands]]
 +
 +===== Notes =====
 +
 +You should always consider what will happen if the values are not equal. ​ For example:
 +
 +    iseq ${answer} Y && goto is_correct
 +
 +If ''​${answer}''​ is not equal to ''​Y''​ then the ''​iseq''​ command will fail and the script will terminate, as described in the [[:​scripting#​error_handling|scripting guide]]. ​ To avoid this problem, you can use the ''​||''​ operator:
 +
 +    iseq ${answer} Y && goto is_correct ||
  
cmd/iseq.txt ยท Last modified: 2011/04/08 18:53 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.