Hello programmers,
I would like to use the calculator bc or octave in shell scripts. I wrote a short shell script "calc" with this
content:
echo "$1" | octave -q | awk '{print $3}'
It's nice, you can do the following, e.g.:
./calc "sin(23),1/3,4*4"
The output is:
-0.84622
0.33333
16
Is it possible to get rid of the double quotes and the
commata in the input? So, I would like to use it like this:
./calc sin(23) 1/3 4*4
Thank you all. Hope its not too difficult.
I would like to use the calculator bc or octave in shell scripts. I wrote a short shell script "calc" with this
content:
echo "$1" | octave -q | awk '{print $3}'
It's nice, you can do the following, e.g.:
./calc "sin(23),1/3,4*4"
The output is:
-0.84622
0.33333
16
Is it possible to get rid of the double quotes and the
commata in the input? So, I would like to use it like this:
./calc sin(23) 1/3 4*4
Thank you all. Hope its not too difficult.