linux 简单的计算器 命令:let

let命令是bash中用于计算的工具,提供常用运算符还提供了方幂**运算符。在变量的房屋计算中不需要加上$来表示变量,如果表达式的值是非0,那么返回的状态值是0;否则,返回的状态值是1。

 

语法

let arg [arg ...] #arg代表运算式

 

用法

自加操作let no++

自减操作let no--

简写形式let no+=10let no-=20,分别等同于let no=no+10let no=no-20

 

实例

#!/bin/bash

let a=5+4 b=9-3

echo $a $b

 

#!/bin/bash

let "t1 = ((a = 5 + 3, b = 7 - 1, c = 15 - 4))"

echo "t1 = $t1, a = $a, b = $b"

付杰
  • ¥ 89.0元
  • 市场价:129.0元
  • ¥ 79.0元
  • 市场价:99.0元
  • ¥ 99.0元
  • 市场价:99.0元
  • ¥ 499.0元
  • 市场价:499.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: