From the course: Troubleshooting and Debugging Bash

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Math challenges

Math challenges - Bash Tutorial

From the course: Troubleshooting and Debugging Bash

Start my 1-month free trial

Math challenges

- [Instructor] Math in Bash is a little clunky. Bash does not understand higher math skills. It only functions with integers. So, if you have a fractional or decimal number that needs to calculate using functions, in Bash, you really need to be sure that only integers are included in that math function. If you need to do math that is more complicated in your script, the only real way to accommodate that need is to go to a completely different programming language like Python. There is a command line utility called BC that can do slightly more complicated math functions. But, you can't depend on that being present on all systems that might run your script, so it's not a best practice to depend on them as a system administrator unless you have 100% complete control over what is on each of the systems that you expect your script to run on. We have plenty of fantastic courses on how to script in Python here on the LinkedIn…

Contents