Error is in stroke:
printf "%15s\t%5d\t%5.2f%%\n" bc <<< "scale=2; 100 * $mac / $totals" > result
i cant understand it. Before bc and after $totals" is sign `
Error is in stroke:
printf "%15s\t%5d\t%5.2f%%\n" bc <<< "scale=2; 100 * $mac / $totals" > result
i cant understand it. Before bc and after $totals" is sign `
printf "%15s\t%5d\t%5.2f%%\n" $(bc <<< "scale=2; 100 * $mac / $totals") > result
^^ ^
You aren't calling bc
. The string bc
is simply the first of 3 expected arguments to printf
. When your shell recognizes <<<
as a redirection operator where the 2nd argument to printf
should be, it throws an error.
I suspect you want $(bc <<< "scale=2; 100 * $mac / $totals")
, but it's not clear which argument to printf
that should be (although, it looks like it should be the third, for the %5.2f
placeholder), or what the other two arguments should be.