When I run the following command:
expr 1.2 * 13
I get this error:
expr: syntax error: unexpected argument '12'
I expect I am missing a syntax. What is it?
The asterisk is expanded as a glob, so you'll end-up running something like expr 1.2 file1 file2 13
expr 1.2 file1 file2 13
Also, the shell cannot do arithmetic with floating point numbers floating point arithmetic with the shell isn’t standard:
expr 1.2 \* 13 expr: non-integer argument
You'll need to use a command like bc/awk/etc... or convert your numbers to integers:
bc
awk
echo '1.2 * 13' | bc 15.6 awk 'BEGIN{ print 1.2 * 13 }' 15.6 expr 12 \* 13 / 10 15
The asterisk is expanded as a glob, so you'll end-up running something like
expr 1.2 file1 file2 13Also,
the shell cannot do arithmetic with floating point numbersfloating point arithmetic with the shell isn’t standard:You'll need to use a command like
bc/awk/etc... or convert your numbers to integers: