0

Unfortunately this result in a empty variable, and bc command print its result to terminal anyway while trying to attribute to aux

aux=&(bc -l <<< "scale = 5; c(${arguments[0]}*$constant)")
echo "$aux"

how can I store this result?

1 Answers1

3

In bash, you should use $(...) to store output of a command, not &(...).

aux=&(...)

is interpreted as aux= and (...) connected by &, i.e. it clears $aux in the background, and runs the bc in a subshell.

choroba
  • 20,299