December 2008
Intermediate to advanced
320 pages
6h 45m
English
Mathematical calculations are an important element of writing shell scripts. In the various flavors of UNIX, there are multiple ways to perform just about any task, and mathematical tasks are no exception.
Although there are many types of mathematical computations, I've limited the discussion in this chapter to the basic operations of addition, subtraction, multiplication, and division, plus remainder, exponentiation, and trigonometric functions. The examples make use of the variables a, b, c, and d.
One note on division: some programming languages don't perform integer division like you might expect from using your traditional calculator. There are two parts to ...