The ((...)) command is equivalent to the let command, except that all characters between the (( and )) are treated as quoted arithmetic expressions. This is more convenient to use than let, because many of the arithmetic operators have special meaning to the Korn shell. The following commands are equivalent:

```
$ let "X=X + 1"
```

and

```
$ ((X=X + 1))
```

Before the Korn shell let and ((...)) commands, the only way to perform arithmetic was with expr. For example, to do the same increment X operation using expr:

```
$ X=`expr $X + 1`
```

In tests on a few systems, the let command performed the same operation 35-60 times faster! That is quite a difference.

Start Free Trial

No credit card required