How it works...

First things first, as this recipe alluded to—we noticed that the Bash shell doesn't like decimal numbers with fractions or even non-whole numbers. Wait, math!? Unfortunately, we can't hide all the details, but in programming, there are a couple of concepts that you should be aware of:

  • Signed and unsigned numbers
  • Floats, doubles, and integers

The first concept is fairly simple—current computers are binary, which means they compute using zeros (0) and ones (1). This means that they work in powers of 2^. Without getting into a lesson about basic computer science, if you see a value (datatype) that is an int (integer) and that it is a 32 bit number, this means that the maximum value if it begins at 0 is 4,294,967,295 in decimal ...

Get Bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.