I'm noticing an error:
bash: syntax error near unexpected token `-105.5*7+50*3'
When executing the below script/expression:
expr (-105.5*7+50*3)/20 + (19^2)/7 | bc -l Is there any other way to evaluate such mathematical/floating point operations?
EDIT #1
NOTE: echo in place of expr does resolve this however I've used expr with bc before and it has handled floats quite normally why not in this scenario is what I'd like to find out now.
exprwithechoand put quotes around the expression.exprwithecho, but you forgot the second part. Quote the expression.expris a command that can also perform (basic integer) arithmetic, but then it's pointless to pipe its output tobc -lwhich also does mathematics. Choose one or the other, not both. Usingechosends the expression to the standard input ofbc -lwhich then evaluates the expression.exprin this scenario b/c the expressions involves floats.exprcan only deal with integer or strings.