163 lines
3.4 KiB
HTML
163 lines
3.4 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content=
|
|
"text/html; charset=utf-8">
|
|
<title>expr - Evaluate arguments as an expression</title>
|
|
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|
</HEAD>
|
|
<body bgcolor="#FFFFFF">
|
|
<!-- Java sync-link -->
|
|
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
|
|
|
|
|
|
|
|
<h2>expr - Evaluate arguments as an expression</h2>
|
|
|
|
<strong>Synopsis</strong>
|
|
|
|
<p><strong>expr</strong> <em>operand ...</em></p>
|
|
|
|
<p><strong>Description</strong></p>
|
|
|
|
<p>The <strong>expr</strong> utility evaluates an expression formed
|
|
by the <em>operands</em> and writes the result to standard
|
|
output.</p>
|
|
|
|
<p><strong>Operands</strong></p>
|
|
|
|
<p>The format of the expression to evaluate is shown as follows.
|
|
<em>expr</em>, <em>expr1</em>, and <em>expr2</em> can be decimal
|
|
integers or strings.</p>
|
|
|
|
<table>
|
|
<tr>
|
|
<td valign="top"><strong>Note:</strong></td>
|
|
<td>The six relational expressions return the result of a decimal
|
|
integer comparison if both arguments are integers. Otherwise, they
|
|
return the result of a string comparison. The result of each
|
|
comparison is 1 if the specified relationship is true, or 0 if the
|
|
relationship is false.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<table>
|
|
<tr>
|
|
<th align="left">Expression</th>
|
|
<th align="left">Description</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td valign="top"><em>expr1</em> | <em>expr2</em></td>
|
|
<td>Returns the evaluation of <em>expr1</em> if it is neither null
|
|
nor zero; otherwise, returns the evaluation of <em>expr2</em>.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td valign="top"><em>expr1</em> & <em>expr2</em></td>
|
|
<td>Returns the evaluation of <em>expr1</em> if neither expression
|
|
evaluates to null or zero; otherwise, returns zero.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> = <em>expr2</em></td>
|
|
<td>Equal.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> > <em>expr2</em></td>
|
|
<td>Greater than.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> >= <em>expr2</em></td>
|
|
<td>Greater than or equal.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> < <em>expr2</em></td>
|
|
<td>Less than.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> <= <em>expr2</em></td>
|
|
<td>Less than or equal.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> != <em>expr2</em></td>
|
|
<td>Not equal.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> + <em>expr2</em></td>
|
|
<td>Addition of decimal integers.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> - <em>expr2</em></td>
|
|
<td>Subtraction of decimal integers.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> * <em>expr2</em></td>
|
|
<td>Multiplication of decimal integers.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> / <em>expr2</em></td>
|
|
<td>Division of decimal integers.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> % <em>expr2</em></td>
|
|
<td>Remainder of decimal integer division.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><em>expr1</em> : <em>expr2</em></td>
|
|
<td>Matching expression.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>( <em>expr</em> )</td>
|
|
<td>Grouping symbols.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p><strong>Exit Status</strong></p>
|
|
|
|
<ul>
|
|
<li>0 when the expression evaluates to neither null nor zero.</li>
|
|
|
|
<li>1 when the expression evaluates to null or zero.</li>
|
|
|
|
<li>2 when the expression is invalid.</li>
|
|
|
|
<li>>2 when an error occurred.</li>
|
|
</ul>
|
|
|
|
<strong>Examples</strong>
|
|
|
|
<ol>
|
|
<li>Evaluate an arithmetic expression.
|
|
|
|
<pre>
|
|
expr 10+10*10/10-10
|
|
</pre>
|
|
</li>
|
|
|
|
<li>Evaluate a true or false condition.
|
|
|
|
<pre>
|
|
expr 10 = 10
|
|
</pre>
|
|
</li>
|
|
</ol>
|
|
|
|
<!-- end ibmbody========================================================= -->
|
|
</body>
|
|
</html>
|
|
|