码迷,mamicode.com
首页 > 系统相关 > 详细

shell 脚本总结2

时间:2015-10-16 06:34:41      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:shell 脚本总结2

echo `seq -s " " 10`  --命令得用反引号
echo $(seq -s " " 10)

(())
let
expr
bc  --特点是支持小数计算
$[]

----------
[root@wmstest ~]# ((ruan=1*8-9))
[root@wmstest ~]# echo $ruan
-1
---------
[root@wmstest ~]# b=$((1*2+3))
[root@wmstest ~]# echo $b
5
---------
[root@wmstest shell_ruanjp]# i=2
[root@wmstest shell_ruanjp]# let i=i+8
[root@wmstest shell_ruanjp]# echo $i
10
---------
[root@wmstest ~]# echo "scale=2;5/3"|bc
1.66
---------
read -p "pls input a number:" var
read -t 3 -p "pls input a number:"  --3秒超时退出

&/dev/null --它的作用


[<测试表达式>]
test -f file && echo 1||echo 0
test ! -f file && echo 1||echo 0
--和上面等同
[ -f file.txt ] && echo 1||echo 0


文件测试操作符

 


while true
do
 代码层
done

shell 脚本总结2

标签:shell 脚本总结2

原文地址:http://10782732.blog.51cto.com/10772732/1703326

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!