Just double-quote ("
) the expression:
echo "$a / ( $b - 34 )" | bc -l
Then bash will expand the $
variables and ignore everything else and bc
will see an expression with parentheses:
$ a=22
$ b=7
$ echo "$a / ( $b - 34 )"
22 / ( 7 - 34 )
$ echo "$a / ( $b - 34 )" | bc -l
-.81481481481481481481