advanced: add bc command
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@178 a672b425-5310-4d7a-af5c-997e18724b81
This commit is contained in:
parent
157d82eca6
commit
43d5cbe436
37
site/pages/cmd/advanced/bc.html
Normal file
37
site/pages/cmd/advanced/bc.html
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
layout: page
|
||||||
|
author: Alessandro Luini
|
||||||
|
category-page: advanced
|
||||||
|
category-title: Advanced commands
|
||||||
|
tags: calculator sum add substract divide calculate compute
|
||||||
|
title: bc
|
||||||
|
---
|
||||||
|
|
||||||
|
<p>
|
||||||
|
In computing, <code>bc</code> is a command in Unix operating systems that can do easy
|
||||||
|
calculations in the shell.<br>
|
||||||
|
Usually input are passed using the <code>echo</code> command and pipes.
|
||||||
|
The name stands for <i>Basic Calculator</i>.<br>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
echo "(12 / 2 - 3) * 3 + 1.5" | bc
|
||||||
|
10.5
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<h3>Interactive mode</h3>
|
||||||
|
|
||||||
|
Using the interactive mode makes you do calculations freely in a special shell inside the shell.
|
||||||
|
All you need to do is run the bc command with the <code>-i</code> flag
|
||||||
|
and no parameter.<br>
|
||||||
|
To exit the interactive mode, write <i>quit</i>.
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
bc -i
|
||||||
|
|
||||||
|
1+1
|
||||||
|
2
|
||||||
|
(12 / 2 - 3) * 3 + 1.5
|
||||||
|
10.2
|
||||||
|
quit
|
||||||
|
</pre>
|
||||||
|
</p>
|
Loading…
Reference in New Issue
Block a user