Artificial intelligent assistant

Parenthesis in expr arithmetic: 3 * (2 + 1) `expr` does not seem to like parenthesis (used in mathematics to explicit operator priority): expr 3 * (2 + 1) bash: syntax error near unexpected token `(' How to express operator priority in bash?

Another way to use `let` bash builtin:


$ let a="3 * (2 + 1)"
$ printf '%s\
' "$a"
9


**Note**

As @Stéphane Chazelas pointed out, in `bash` you should use `((...))` to do arithmetic over `expr` or `let` for legibility.

For portability, use `$((...))` like @Bernhard answer.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e8face6c0a286573e76ab741d739e8dc