declare的使用

682阅读 0评论2010-09-15 zhengsenlin888
分类:

test @test test]# declare [-afirx] 
参数说明: 
-a  :定义为数组 array 
-f  :定义为函数 function  
-i  :定义为整数 integer 
-r  :定义为『只读』 
-x  :定义为透过环境输出变量 
范例: 
[test @test test]# declare -i a=3 
[test @test test]# declare -i b=5 
[test @test test]# declare -i c=$a*$b 
[test @test test]# echo $c 
15  <==变成数字啰! ^_^
上一篇:我比较常用的vi的一些常用快捷操作
下一篇:shell基本操作 变量等