Chinaunix首页 | 论坛 | 博客
  • 博客访问: 207930
  • 博文数量: 26
  • 博客积分: 572
  • 博客等级: 中士
  • 技术积分: 262
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-16 20:34
文章分类

全部博文(26)

文章存档

2011年(26)

分类: LINUX

2011-05-19 12:18:41

Here is a partial list of the conditions that test can evaluate. Since test is a shell builtin, use "help test" to see a complete list.

Expression

Description

-d file

True if file is a directory.

-e file

True if file exists.

-f file

True if file exists and is a regular file.

-L file

True if file is a symbolic link.

-r file

True if file is a file readable by you.

-w file

True if file is a file writable by you.

-x file

True if file is a file executable by you.

file1 -nt file2

True if file1 is newer than (according to modification time) file2

file1 -ot file2

True if file1 is older than file2

-z string

True if string is empty.

-n string

True if string is not empty.

string1 = string2

True if string1 equals string2.

string1 != string2

True if string1 does not equal string2.

if [ ! -d /opt/src ]    if和中括号之间有空格,中括号和!之间有空格,!号和-d之间有空格,-d和/之间有空格,中括号和src之间有空格
阅读(1339) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~