O'Reilly logo

Korn Shell: Unix and Linux Programming Manual, Third Edition, The by Anatole Olczak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Arithmetic

Integer arithmetic is performed with the let and ((...)) commands. All of the operators from the C programming language (except ++, – –, and ?:) are supported by the Korn shell. The format for arithmetic constants is:

numberorbase#number

where base is a decimal number between 2 and 36 that specifies the arithmetic base. If not specified, the default is base 10. The arithmetic base can also be set with the typeset –i command.

Arithmetic Commands

let "arithmetic-expression" ((arithmetic-expression))evaluate arithmetic expression
integer variabledeclare an integer variable
integer variable=integer-valuedeclare an integer variable and set it to a value
integer variable="arithmetic-assignment-expression"declare an integer variable and assign ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required