Re: Simple calculator
On Mon, Oct 26, 1998 at 05:56:46PM +0000, James Troup wrote:
> > > > #!/bin/sh
> > > > if [ $# = 0 ]; then
> > > > echo "`basename $0`: must supply something to calculate!" >&2
> > > > exit 1
> > > > echo "$*" | bc -l | sed 's/0*$//'
>
> Okay, anyone got any other ideas for a name? Using alternatives to
> manage apcalc's calc and this small shell script doesn't seem right
> somehow...
scalc (simple calc) or fcalc (fast calc -- not that it's fast) or ccalc
(command-line calc)
BTW, the script as it is has a bug. It strips too many trailing zeroes (it
strips the zero in 2180 for example)
MArcelo
Reply to: