I am new to bash scripting. I am currently performing a simple arithmetic problem that involves a floating integer. I know that bash by itself does not do arithmetic with floating integers. So I am using the bc calculator tool. The only issue is the syntax. I am able to get results but not in the desired way. How can I assign $N_RESULTS the value of the math operation?
//I get arithmetic error with this syntax
NUM1=128.17333
let "N_RESULTS = ($NUM1 - 1) / 10 + 1" | bc -l
echo $N_RESULTS
_
//I get correct results if do something like this
NUM1=128.17333
echo "($NUM1 - 1) / 10 + 1" | bc -l