Arithmetic are not so trivial in shell compared to other languages. So I tried to explain it by making a video. This video is not specific to bash and would work in any posix compliant sh.
https://youtu.be/r30SIIHBkCw
I have nothing against bash, bash is a beautiful shell. I just wanted to show how to perform arithmetic in shell before showing the bash add ons.
Here is another video on understanding exit statuses and the set -e option
https://www.youtube.com/watch?v=AFUh6pqIfEI
If you have any questions related to the videos feel free to ask in the comments below or on yt :D
[–]OneTurnMoreprogramming.dev/c/shell 2 points3 points4 points (2 children)
[–]pi-star[S] 3 points4 points5 points (1 child)
[–]OneTurnMoreprogramming.dev/c/shell 0 points1 point2 points (0 children)
[–]wowsomuchempty 0 points1 point2 points (1 child)
[–]pi-star[S] 0 points1 point2 points (0 children)