您的位置:首页 > 理论基础 > 计算机网络

TCPdump抓包命令详解1

2015-08-26 11:17 411 查看
typeset也可以实现计算

[root@linhexiao shellTest]# typeset -i a=1 b=3
[root@linhexiao shellTest]# a=a+b
[root@linhexiao shellTest]# echo $a
4
[root@linhexiao shellTest]# a=a*b
[root@linhexiao shellTest]# echo $a
12

 $[ ]也可以实现计算

1)只要式合法的表达式都可以计算
[root@linhexiao shellTest]# echo $[2+3]
5
[root@linhexiao shellTest]# echo $[2+ 3]
5
[root@linhexiao shellTest]# echo $[ 2+ 3]
5
2)$[]不可以计算小数
[root@linhexiao shellTest]# echo $[ 2.2+ 3]
bash: 2.2+ 3: syntax error: invalid arithmetic operator (error token is ".2+ 3")
[root@linhexiao shellTest]# echo $[ 2+ 3]
5
[root@linhexiao shellTest]# echo $[ 2- 3]
-1
[root@linhexiao shellTest]# echo $[ 2* 3]
6
[root@linhexiao shellTest]# echo $[ 2** 3]
8
[root@linhexiao shellTest]# echo $[ 2/ 3]
0

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: