$((...)) is an arithmetic expression; it expands to the value of the expression inside the parentheses. Since this is not a command, it does not have an exit status or return value. A Boolean expression evaluates to 1 if it is true, 0 if it is false.
((...)) , on the other hand, is an arithmetic statement. This is a team in itself that works by evaluating its body as an arithmetic expression, and then looking at the resulting value. If the value is true, the command completes successfully and has an exit status of 0. If the value is false, the command completes with an error and has an exit status of 1.
A good idea when learning bash stop thinking about conditions in if , while loops, etc. as true or false, but rather if the teams succeed or fail. After all, shell languages ββare not designed to process data; they are the glue language for launching other programs.
source share