ITPub博客

首页 > Linux操作系统 > Linux操作系统 > AIX下的小计算器 bc

AIX下的小计算器 bc

原创 Linux操作系统 作者:wmlm 时间:2009-02-27 11:05:13 0 删除 编辑
AIX下有时候想做个简单计算,使用bc很方便,示例如下:[@more@]

# vmstat

System configuration: lcpu=1 mem=1024MB ent=0.10

kthr memory page faults cpu
----- ----------- ------------------------ ------------ -----------------------
r b avm fre re pi po fr sr cy in sy cs us sy id wa pc ec
1 1 136360 24579 0 0 0 0 0 0 14 197 305 2 3 95 0 0.01 5.9
# bc
4*24579
98316
4*136360
545440

man中的解释
Examples
1 You can use the bc command as a calculator. Depending on whether you
set the scale variable and with what value, the system displays
fractional amounts. Entering:

bc
1/4

displays only 0. To set the scale variable and add a comment, enter:

scale = 1 /* Keep 1 decimal place */
1/4

The screen displays 0.2. Entering:

scale = 3 /* Keep 3 decimal places */
1/4

displays 0.250. Entering:

16+63/5

displays 28.600. Entering

(16+63)/5

displays 15.800. Entering

71/6

displays 11.833.

The bc command displays the value of each expression when you press
the Enter key, except for assignments.

When you enter the bc command expressions directly from the
keyboard, press the End-of-File (Ctrl-D) key sequence to end the bc

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/271063/viewspace-1017881/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: aix5l oracle9206
请登录后发表评论 登录
全部评论

注册时间:2008-04-08

  • 博文量
    398
  • 访问量
    3716787