How to add this kind of behavior to zsh:

 $ = 2 +4
 2 + 4 = 6

First, we need a command to do calculus. Personnaly, I love qalc command, so I use it as calculator. Nevertheless, it is not a standard command, so it is usefull to have a fallback. Zsh arithmetic expansion is great, we could use it:

function myCalculator() {
  echo $(($*))
}

Now, we need to add an alias to = command. But, alias doesn't accept syntax alias ==myCalculator. So we have to edit manualy aliases has table:

 $ # Be sure zsh/parameter module is loaded
 $ zmodload zsh/parameter
 $ aliases[=]=myCalculator

To use it, don't forget you need to type a space between = and your expression

Currently, I havn't find any solution for bash