Skip to Main Content
Expert Shell Scripting
book

Expert Shell Scripting

by Ron Peters
December 2008
Intermediate to advanced content levelIntermediate to advanced
320 pages
6h 45m
English
Apress
Content preview from Expert Shell Scripting

PART 2System Interaction and Advanced Techniques

CHAPTER 11Math from the Shell

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

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.
Start your free trial

You might also like

Robust Shell Scripting

Robust Shell Scripting

Arnold Robbins
Hacker Techniques, Tools, and Incident Handling

Hacker Techniques, Tools, and Incident Handling

Sean-Philip Oriyano, Michael Gregg

Publisher Resources

ISBN: 9781430218418Purchase book