We have seen that the shell can handle all types of integer arithmetic, but what if we need to perform higher math or even just use floating-point numbers? The answer is, we can’t. At least not directly with the shell. To do this, we need to use an external program. There are several approaches we can take. Embedding Perl or AWK programs is one possible solution but, unfortunately, outside the scope of this book.
Another approach is to use a specialized calculator program. One such program found on most Linux systems is called
bc program reads a file written in its own C-like language and executes it. A
bc script may be a separate file, or it may be read from standard input. The
bc language supports ...