let — Shell Built-in Function to Evaluate One or More Arithmetic Expressions

Synopsis

ksh
let "arg"... 

Description

ksh

Use the let command to perform integer arithmetic as specified by one or more arguments. Each arg can contain numbers, operators, constants, and shell variables that define a separate arithmetic expression to be evaluated. Use double quotes with any arguments that contain spaces or other special characters. You can also use double parentheses ((...)) instead of double quotes for arguments that contain white space.

The exit status is 0 if the value of the last expression is non-zero, and 1 otherwise.

Examples

The following example sets the variable X to the sum of 1 + 1.

$ let "X=1 + 1" 
$ print $X 
2 
$ 

Attributes

See ...

Get Solaris™ 7 Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.