O'Reilly logo

Shell Scripting Recipes: A Problem-Solution Approach, Second Edition by Jayant Varma, Chris F. A. Johnson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 5

image

Scripting by Numbers

Number crunching was once the domain of big mainframe computers hidden away in secure, air-conditioned rooms. Now, the computer on your desk (or even the one in your pocket) has more computing power than those old behemoths. The shell, with the help of external commands, can harness that power.

POSIX shells have arithmetic built in, but are limited to integers. Multiplication of decimal fractions can be done in the shell with the fpmul function, which appears in the math-funcs library described next. Other operations could also be coded with shell arithmetic, but they are more complicated, and external commands ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required