Preventing Asterisk Expansion in Function Params in Bourne Shell Script
I'm writing a shell script in which I am performing floating point calculations. I cannot use `expr` since it does not support real numbers, so I decided to write/use a function to use `bc` like this:
The problem is that the asterisk is expanded to all filenames in the current directory when it is passed to math(). Escaping it (\*) does not help because then `bc` won't accept the string.
echo $1 | bc -l
result=`math "2.4 * 6.8"`
Have you any ideas besides a hack in which I use escapes then remove them in math()? That may be the route I'll be forced to take, but I'd prefer something cleaner.