I'd like to be able to redirect the
stderr of a double-parentheses construct.
would output some error messages if
$var2 = 0, I do not want the user to see this.
I know I could simply check for zero before doing the division, but I'd like to know if there is a way to do this redirection, for curiosity and because it might turn out useful in other situations.
I've already tried:
a=$(($var/$var2)) 2> /dev/null
Which does not work and
a=$(($var/$var2 2> /dev/null ))
Which gives a syntax error.