Re: command-line calculator?

2004-06-26 Thread Tom McLaughlin
On Fri, 2004-06-25 at 11:41, CD Baby wrote:
> What simple built-in command-line tools are available if I want to
> just do some simple math on the command line?
> 
> If I'm there in a shell, and need to know what 17 times 36 equals?

calc

It's in ports and easier than anything else I've seen suggested.


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: command-line calculator?

2004-06-25 Thread Sergey Zaharchenko
On Fri, Jun 25, 2004 at 01:31:33PM -0600,
 Warren Block probably wrote:
> On Fri, 25 Jun 2004, Parv wrote:
> 
> > Perl:
> >   perl -e 'print +(17 * 36)'
> 
> Or just
> 
>  perl -e 'print 17 * 36'
> 
> but for neatness
> 
>  perl -e 'print 17 * 36, "\n"'

Or just

$ sh -c 'echo $((17*36))'
612

or

$ echo $((17*36))

if you use sh as your interactive shell.

-- 
DoubleF
The first time, it's a KLUDGE!
The second, a trick.
Later, it's a well-established technique!
-- Mike Broido, Intermetrics


pgp0FFui5t4Nb.pgp
Description: PGP signature


Re: command-line calculator?

2004-06-25 Thread Bill Schoolcraft
At Fri, 25 Jun 2004 it looks like Aaron composed:

> CD Baby wrote:
> > What simple built-in command-line tools are available if I want to
> > just do some simple math on the command line?
> >
> > If I'm there in a shell, and need to know what 17 times 36 equals?
>
> $ bc
> bc 1.06
> Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
> This is free software with ABSOLUTELY NO WARRANTY.
> For details type `warranty'.
> 17*36
> 612
> ^D

I usually try this.

echo 17*36 | bc

Then you don't have to start and stop bc.


--
Bill Schoolcraft
PO Box 210076 -o)
San Francisco CA 94121 /\
"UNIX, A Way Of Life."_\_v

http://billschoolcraft.com

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: command-line calculator?

2004-06-25 Thread Parv
in message <[EMAIL PROTECTED]>,
wrote Parv thusly...
>
>   Perl:
> perl -e 'print +(17 * 36)'
> 
>   awk:
> echo |awk '{print 17 * 36}'

Oh, in Rexx...

  echo 'say 17 * 36 ' | rexx

  ...or...

  rexx  #  Interpreter
  say 17 * 36
  ^D  # Ctrl-D


Just wondering out loud ... Is it not possible either in rexx-imc or
-regina to have something like the perl functionality (make rexx to
execute a string as if it were a valid statement/expression) ?


  - Parv

-- 

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: command-line calculator?

2004-06-25 Thread Warren Block
On Fri, 25 Jun 2004, Parv wrote:
 Perl:
   perl -e 'print +(17 * 36)'
Or just
 perl -e 'print 17 * 36'
but for neatness
 perl -e 'print 17 * 36, "\n"'
-Warren Block * Rapid City, South Dakota USA
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: command-line calculator?

2004-06-25 Thread Parv
in message <[EMAIL PROTECTED]>,
wrote CD Baby thusly...
>
> What simple built-in command-line tools are available if I want to
> just do some simple math on the command line?
> 
> If I'm there in a shell, and need to know what 17 times 36 equals?

In addition to [bd]c(1) ...

  Perl:
perl -e 'print +(17 * 36)'

  awk:
echo |awk '{print 17 * 36}'


  - Parv

-- 

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: command-line calculator?

2004-06-25 Thread Hemal Pandya
man expr
man bc


On Fri, 25 Jun 2004 08:41:02 -0700, CD Baby <[EMAIL PROTECTED]> wrote:
> 
> What simple built-in command-line tools are available if I want to
> just do some simple math on the command line?
> 
> If I'm there in a shell, and need to know what 17 times 36 equals?
> ___
> [EMAIL PROTECTED] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
>
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: command-line calculator?

2004-06-25 Thread Paul Bissex
On Fri, 25 Jun 2004 08:41:02 -0700, CD Baby <[EMAIL PROTECTED]> wrote:
> 
> What simple built-in command-line tools are available if I want to
> just do some simple math on the command line?

Here are two possibilities:

:~> man -k calculator
bc(1)- An arbitrary precision calculator language
dc(1)- an arbitrary precision calculator
  
  
  
  
~> bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
17 * 36
612
  
  
  
  
~> dc
17 36 * p
612


-- 
paul bissex, e-scribe.com -- database-driven web development
413.585.8095
69.55.225.29
01061-0847
72°39'71"W 42°19'42"N
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: command-line calculator?

2004-06-25 Thread Norbert Koch
CD Baby <[EMAIL PROTECTED]> writes:

> What simple built-in command-line tools are available if I want to
> just do some simple math on the command line?
>
> If I'm there in a shell, and need to know what 17 times 36 equals?

echo "17 * 36" | bc

norbert.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


RE: command-line calculator?

2004-06-25 Thread Barry Byrne

> What simple built-in command-line tools are available if I want to
> just do some simple math on the command line?


man bc

 - Barry

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: command-line calculator?

2004-06-25 Thread Aaron
CD Baby wrote:
What simple built-in command-line tools are available if I want to
just do some simple math on the command line?
If I'm there in a shell, and need to know what 17 times 36 equals?
$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
17*36
612
^D
--
Aaron
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"