3 ms·
I'm going to assume that if one is using [ rather than [[ then one will also want to use expr rather than $(()).
by kqr 3y ago
I'm going to assume that if one is using [ rather than [[ then one will also want to use expr rather than $(()).
- ykonstant 3y agoArithmetic expansion is a feature of all POSIX compliant shells, which furthermore advises against using `expr`. The latter is only needed for non-compliant shells like some legacy implementations of the Bourne shell.
- kqr 3y agoOh, I did not know that! Thanks.
- darrenf 3y agoWhat's the basis for that assumption? I'm struggling to see a reason to not use the shell for arithmetic, regardless of `/usr/bin/[`, builtin `[` or `[[`.