On 12/19/22 09:30, dchme...@gmail.com wrote:
Lately I read about the expr command, which I'm arguing is programmed wrong for only working right when you put spaces into expressions rather than working for standard mathematical expressions, which don't use spaces. Think back to your mathematics classes: any instructor that knows what they're doing doesn't use spaces in expressions. You don't use spaces in graphing calculators. You don't use spaces in similar mathematics software. It's just not the proper writing style. Expr should be switched around or at least configurable to how mathematicians and older programmers write versus letting people go with the fad of younger programmers who forgot maths classes and write for unnecessaru 'readability' which actually also looks worse and begins to take up too much space.
`expr` is a very old tool, and POSIX defines the syntax that tool allows: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/expr.html Hence, we have to care more about compatibility rather than allowing newer or fancier input syntax. The above POSIX page already states: In many cases, the arithmetic and string features provided as part of the shell command language are easier to use than their equivalents in expr. Newly written scripts should avoid expr in favor of the new features within the shell If the shell arithmetic is not sufficient, then I'd recommend bc(1). Have a nice day, Berny