in the shell i type:
bc -l <<< '90.8/(179*179)*10000'
and i get the correct output:
28.33869105208951030000
however i am not able to format this correct in a bash script:
calculate_bmi () {
BMI="$(bc -l <<< '${1}/(${2}*${2})*10000)'"
echo "${BMI}"
}
I get all kind of strange errors when i tried different experiments. Latest error is:
./wts.sh: command substitution: line 25: syntax error near unexpected token `('
./wts.sh: command substitution: line 25: `bc -l <<< ${1}/(${2}*${2})*10000)"'
Please help me.
bcgo to standard output instead of capturing it.calculate_bmi () { bc -l <<< "$1/($2*$2)*10000"; }.