Chinaunix首页 | 论坛 | 博客
  • 博客访问: 100882
  • 博文数量: 13
  • 博客积分: 1415
  • 博客等级: 上尉
  • 技术积分: 330
  • 用 户 组: 普通用户
  • 注册时间: 2005-11-01 15:32
文章分类

全部博文(13)

文章存档

2009年(2)

2008年(11)

我的朋友
最近访客

分类:

2008-06-25 18:16:13

################################################
##########          测试数值          ##########
################################################
eq   数值相等。
ne   数值不相等。
gt   第一个数大于第二个数。
lt   第一个数小于第二个数。
le   第一个数小于等于第二个数。
ge   第一个数大于等于第二个数。

数值计算
expr 1 + (3 * 2)

自增
COUNT=0
COUNT=`expr $COUNT + 1`
自增的另外一种用法
COUNT=$[COUNT + 1]


################################################
##########         字符串数值         ##########
################################################
=  两个字符串相等
!= 两个字符串不等
-z 空串
-n 非空串

################################################
##########         逻辑操作符         ##########
################################################
-a 逻辑与
-o 逻辑或
! 逻辑否


################################################
##########           控制流           ##########
################################################
if 条件1
then
elif 条件2
then
fi


case 值 in
模式1)
      命令1
      ...
      ;;
模式2)
      命令2
      ;;
*)
      缺省命令
      ;;
esac


for 变量名 in 列表
do
...
done


until 条件
      命令1
      ...
done


while 条件
do
...
done


################################################
##########        文件状态测试       ##########
################################################
-b file
     True if file is a Block special device.
-c file
     True if file is a Character special device.
-d file
     True if file is a Directory.
-e file
     True if file Exists.
-f file
     True if file is a regular File.
-g file
     True if file has its set-group-id bit set.
-G file
     True if file is owned by the current effective group id.
-k file
     True if file has its "sticky" bit set.
-h file
-L file
     True if file is a symbolic Link.
-O file
     True if file is owned by the current effective user id.
-p file
     True if file is a named Pipe.
-r file
     True if file is readable.
-S file
     True if file is a Socket.
-s file
     True if file has a Size greater than zero.
-t [FD]
     True if FD is opened on a terminal.  If FD is omitted, it defaults
     to 1 (standard output).
-u file
     True if file has its set-user-id bit set.
-w file
     True if file is writable.
-x file
     True if file is executable.
file1 -ef file2
     True if file1 and file2 have the same device and inode numbers,
     i.e., if they are hard links to each other.

阅读(812) | 评论(0) | 转发(0) |
0

上一篇:linux indent 命令详解

下一篇:perl学习笔记

给主人留下些什么吧!~~