当前位置:网站首页>shell-运算符
shell-运算符
2022-06-29 23:34:00 【爱吃水饺的小京】
declare声明变量类型
declare [+/-][选项]变量名
-:给变量设定类型舒心
+:取消变量的类型属性
-i:将变量声明为整数型(integer)
-x:将变量声明为环境变量
-p:显示指定变量的被声明类型
数值运算
方法1
使用declare -i
aa=11
bb=22
declare -i cc=$aa+$bb
echo $cc
33
expr或let数值运算工具
aa=22
bb=33
dd=$(expr $aa + $bb)
echo $dd
55
( ( 运 算 式 ) ) 或 ((运算式)) 或 ((运算式))或[运算式]
aa=33
bb=44
cc=$(($aa+$bb))
echo $cc
77
边栏推荐
- 深度学习的历史
- 正则表达式:字符(2)
- Solr基础操作2
- Cacti关于spine轮询的设置
- Solr basic operation 4
- Leetcode 1385. Distance value between two arrays
- Matplotlib plt Hist() parameter explanation
- 收藏!这些提高程序员生产力的工具你用过吗?
- Is it safe to open a stock account? Shanghai stock account opening.
- Start harvesting! Nailing: adjust the maximum number of free users of "nailing team". If the number exceeds 10, it will not work normally
猜你喜欢

为什么 JSX 语法这么香?

Gracefully transform the SMS business module and start the strategic mode!

软件测试 接口测试 Jmeter 5.5 安装教程

Paper writing tool: latex online website

语音信号处理(二): 发声生理、听觉生理与听觉心理

Pain points and solutions of M1 notebook home office | community essay solicitation

redis客户端

AI empowers new retail, the way to win "wisdom" lies in ecological thinking | selected excerpts from digital intelligence night talk live broadcast

声网自研传输层协议 AUT 的落地实践丨Dev for Dev 专栏

@Scheduled注解的坑,我替你踩了
随机推荐
网上开户选哪个证券公司?还有,在线开户安全么?
动态代理的实现原理
简单理解B树和B+树
Constexpr function
远程沟通高效的自我总结| 社区征文
LC:最大子数组和
剑指 Offer 38. 字符串的排列
Intranet penetration (NC)
Collection! Have you ever used these tools to improve programmer productivity?
Start harvesting! Nailing: adjust the maximum number of free users of "nailing team". If the number exceeds 10, it will not work normally
提供有效的绩效评估
C pointer advanced 1-- > character pointer, array pointer, pointer and array parameter transfer, function pointer
LC: maximum subarray and
2022 PMP project management examination agile knowledge points (5)
[leetcode] a number that appears only once [136]
软件测试 接口测试 Postman测试工具 接口测试的流程 执行接口测试 接口关联 环境变量和全局变量 内置动态参数以及自动有的动态参数
Open source the Ernie tiny lightweight technology of "Wenxin big model", which is accurate and fast, with full effect
C pointer advanced 2-- > function pointer array callback function simplifies calculator code, and implements qsort function based on callback function simulation
Top ten securities companies: "bulldozer market" reappearance
LC:有效的数独 + 旋转图像