The bash commands that result in a valid arithmetic expansion are:
TOTAL=$[8/2]
TOTAL=$((5+2))
((TOTAL++))
Arithmetic expansion is a bash feature that allows you to perform integer calculations and assign or use the result in a command or expression. There are two syntaxes for arithmetic expansion: [expression]and((expression)). The expression can contain variables, operators, parentheses, etc. The ((expression)) syntax can also be used without the $ sign for assignments or conditional tests. References: https://documentation.suse.com/sles/15-SP3/html/SLES-all/cha-bash.html#sec-bash-arithmetic
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit