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 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.