This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the bash category.
Last Updated: 2024-11-23
Here's a very brief comparison of ways to do command line calculation :
expr
does not do decimal. Avoid.
bc -l
does. You must give it that -l
flag to load the math "library". Note that bc
must be interacted by echoing into it. E.g. 7 / 3 | bc -l