195
Like programming in bash
(lemmy.ml)
Post funny things about programming here! (Or just rant about your favourite programming language.)
But, but like ... hear me out.
echo $((1+1))
That is a posixly correct method to do arithmetic expressions.
Huh, seems you're right. I was under the impression this wouldn't work in dash but apparently that's wrong.
Yep! The functionality for performing arithmetic expressions this way is called “arithmetic expansion”.
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_06_04