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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access