This has nothing to do with BASH (other than that is common behavior in all Unix shells) or the Pi. It is a basic limitation of 'expr'. As you've deduced, you need to escape any arguments to 'expr' that are "special" to the shell. This includes, as you've noted, the * character.
'expr' is pretty much obsolete in the modern world. Back in the day, it was all we had, but there are better tools available now.
Using bash, the simplest way to do math in the shell is to use $(()) like this:
$ echo $((85*3))
$ echo $((foo*bar))
Now, if you are maintaining old code that uses 'expr', then the original authors would have been aware of these limitations and coded accordingly. If you are writing new code, don't use 'expr'.
Last edited by n67
on Thu Nov 09, 2017 1:30 pm, edited 1 time in total.
"L'enfer, c'est les autres"
G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:
J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!