From: Sidney Lambe on
Bc is a handy console calcualator found on most
distributions, but very few people know how to
use it.

(It will do very sophisticated mathematics, too, but
that's beyond me.)

Create /etc/bc and put this in it:

scale=3

That sets the number of decimal places bc will
calculate to.

In your system-wide bash rc file put:

export BC_ENV_ARGS="/etc/bc"
alias bc='bc -lq'

-lq tells bc to load a math library and not
to print the GNU bc header.

Newbies, be sure to source that file in any open
terminals/x-terms after adding the above to it:

$. /etc/<system-wide bash rc file>
or
$source /etc/<system-wide bash rc file>

Ordinary usage:

$bc
4 + 8
12
4 - 8
-4
4 * 8
32
4 / 8
..500
sqrt(8)
2.828

A period will cause bc to substitute the last answer:

$bc
3 + 4
7
.. + 3
10


$echo "3 + 3" | bc
6

Somewhat more advanced usage:

$bc
(3 * 3) / 3
3.000
sqrt(5 * 5)
5.000

You get the drift.

Ctrl-c (^C) to quit bc.

$/usr/bin/bc -v
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.

Sid


Hope this helps. I love this little utility. The X ones just suck.


Sid



From: Rui Maciel on
Sidney Lambe wrote:

> Hope this helps. I love this little utility. The X ones just suck.

It's as easy to fire up programs such as Octave and Maxima than it is to run bc, which doesn't
make bc very competitive.


Rui Maciel
From: John Hasler on
Rui Maciel writes:
> It's as easy to fire up programs such as Octave and Maxima than it is
> to run bc...

I don't find that to be the case.
--
John Hasler
jhasler(a)newsguy.com
Dancing Horse Hill
Elmwood, WI USA
From: Sidney Lambe on
On comp.os.linux.misc, Rui Maciel <rui.maciel(a)gmail.com> wrote:

> Sidney Lambe wrote:
>
>> Hope this helps. I love this little utility. The X ones just
>> suck.
>
> It's as easy to fire up programs such as Octave and Maxima than
> it is to run bc, which doesn't make bc very competitive.
>
>
> Rui Maciel

Well, that's probably because you don't type well. The only thing
I currently use X for is xpdf. At the moment I couldn't tell you
where my mouse is. I use the console window manager GNU screen,
which has very advanced cut&paste capabilities and is entirely
operated from the keyboard. Got 7 open windows right now. X isn't
even up.

Screen is awesome. You should be familiar with its basic
operations in case you find yourself in an X-less environment,
like many servers and modems and such. Or rescue disks and
embedded systems. It has very good networking capabilities. You
can attach to remote screen sessions. Much, much more. Best
window manager there is, in my estimation.

You can get the manual from gnu.org.

You won't master the computer unless you can type well.

Cheers,

Sid



From: Michael Black on
On Tue, 23 Mar 2010, Sidney Lambe wrote:

> On comp.os.linux.misc, Rui Maciel <rui.maciel(a)gmail.com> wrote:
>
>> Sidney Lambe wrote:
>>
>>> Hope this helps. I love this little utility. The X ones just
>>> suck.
>>
>> It's as easy to fire up programs such as Octave and Maxima than
>> it is to run bc, which doesn't make bc very competitive.
>>
>>
>> Rui Maciel
>
> Well, that's probably because you don't type well. The only thing
> I currently use X for is xpdf. At the moment I couldn't tell you
> where my mouse is. I use the console window manager GNU screen,
> which has very advanced cut&paste capabilities and is entirely
> operated from the keyboard. Got 7 open windows right now. X isn't
> even up.
>
What about when you use FF. There was a time when you didn't even claim
to use a non-graphic browser. There are actually instances when
a graphic browser is appropriate, and those 406 errors I've been getting
in recent years is actually becoming a non insignificant factor.

And if you don't use a mouse, then you're a fool. GPM is the greatest
thing ever, just because one isn't using a GUI doesn't mean there isn't
a use for the mouse to cut and paste. Even dealing with directories,
it's a whole lot easier to cut and paste than type things in.

"FF" is of course your alias for Firefox, as if anyone actually doesn't
leave a browser running at all times.

Michael
 |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11
Prev: inetd problems
Next: Downloading andLinux