Math

One of the more common data manipulation needs involves arithmetic. You saw a few simple math operations in some of the sample scripts in the previous section of this chapter. The Korn Shell provides the standard add, subtract, multiply, and divide capabilities. Additionally, Korn Shell 93 greatly expands the math options available to the script writer by providing floating-point variables and additional canned math functions such as sin(), cos(), tan(), sqrt(), and others.

Korn Shell 93 also has provisions for various base number systems. Because the shell provides different base numbering systems, it also provides the tools to use those bases. Not that the average shell script writer will need them very often, but the Korn shell actually ...

Get Korn Shell Programming by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.