3+4;5*2;5^2;18/4 <=一行輸入多個計算,用;相隔。
7
10
25
4
quit <=退出
# 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'.
scale=3 <=設小數位
1/3
.333
quit
以上是交互的計算,那到也可以不進行交互而直接計算出結果。
A.用echo和|法,如:
# echo "(6+3)*2" |bc
18
# echo 15/4 |bc
3
# echo "scale=2;15/4" |bc
3.75
# echo "3+4;5*2;5^2;18/4" |bc
7
10
25
4