let(1) MPE/iX Shell and Utilities let(1)
______________________________________________________________________
NAME
let -- evaluate arithmetic expressions
SYNOPSIS
let expression ...
((expression))
DESCRIPTION
let evaluates each arithmetic expression from left to right,
using long integer arithmetic with no checks for overflow. No
output is generated; the exit status is 0 if the last expression
has a non-zero value, and 1 otherwise.
The following two lines are equivalent: the second form avoids
quoting and enhances readability.
let "expression"
((expression))
The portable way to write these commands is to the POSIX command:
: $((expression))
Expressions consist of named variables, numeric constants, and
operators.
See Arithmetic Substitutions in sh(1) for syntax of expressions.
EXAMPLE
The commands
let a=7 'b=4*2' c=b+1
echo $a $b $c
produce
7 8 9
DIAGNOSTICS
Possible exit status values are:
0 The last argument evaluated to a non-zero value.
1 The last argument evaluated to a zero value, or the expression
contained a syntax error, or tried to divide by zero.
Messages
Because this utility is built into the MPE/iX Shell, see the
sh(1) man page for a complete list of error messages that you may
receive when using it.
1
let(1) MPE/iX Shell and Utilities let(1)
______________________________________________________________________
PORTABILITY
let is built into the KornShell on UNIX systems, and is not a
Bourne Shell command.
NOTE
This command is built into the shell.
SEE ALSO
sh(1), expr(1) test(1)
2