nonethefewer: (Default)
[personal profile] nonethefewer
To do basic calculations on the command line in *nix/*nux:

echo 2+2 | bc

Or just type bc, and go from there.

http://linux.die.net/man/1/bc

(no subject)

Date: 2009-09-03 05:31 am (UTC)
From: [identity profile] modularformsboy.livejournal.com
or:

echo $((2 + 2))

or:

echo 2 2 + p | dc

(no subject)

Date: 2009-09-03 05:57 am (UTC)
From: [identity profile] the-xtina.livejournal.com
Huh, cool.  The latter I can follow; how does the former go?  Why does that go?

(no subject)

Date: 2009-09-04 03:29 pm (UTC)
From: [identity profile] hitchhiker.livejournal.com
bash syntax for "evaluate this as an arithmetic expression" (http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-10.html#ss10.2).
Page generated Jun. 19th, 2025 01:59 pm
Powered by Dreamwidth Studios