-a file exists. 

-b file exists and is a block special file. 

-c file exists and is a character special file. 

-d file exists and is a directory. 

-e file exists (just the same as -a). 

-f file exists and is a regular file. (常用)

-g file exists and has its setgid(2) bit set. 

-G file exists and has the same group ID as this process. 

-k file exists and has its sticky bit set. 

-L file exists and is a symbolic link. 

-n string length is not zero. 

-o Named option is set on. 

-O file exists and is owned by the user ID of this process. 

-p file exists and is a first in, first out (FIFO) special file or 

named pipe. 

-r file exists and is readable by the current process. 

-s file exists and has a size greater than zero. 

-S file exists and is a socket. 

-t file descriptor number fildes is open and associated with a 

terminal device. 

-u file exists and has its setuid(2) bit set. 

-w file exists and is writable by the current process. 

-x file exists and is executable by the current process.

-z string length is zero.

例子:

if [ -f "$LOG/cws_inv.data" ];then
rm $LOG/cws_inv.data
fi

注意:文件最好用”“括起来。

linux shell 判断文件是否存在等符号的更多相关文章

  1. Linux shell判断文件和文件夹是否存在

    shell判断文件,目录是否存在或者具有权限 #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/acc ...

  2. [转] Linux shell判断文件和文件夹是否存在

    shell判断文件,目录是否存在或者具有权限 #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/acc ...

  3. linux shell判断文件,目录是否存在或者具有权限

    在linux中判断文件,目录是否存在或则具有的权限,根据最近的学习以及网上的资料,进行了以下的总结: #!/bin/sh myPath="/var/log/httpd/" myFi ...

  4. Linux shell判断文件和文件夹是否存在(转发)

    #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/access.log" #这里的-x 参数 ...

  5. Linux Shell 判断块设备节点是否存在

    /************************************************************************* * Linux Shell 判断块设备节点是否存在 ...

  6. shell判断文件是否存在

    转自:http://www.cnblogs.com/sunyubo/archive/2011/10/17/2282047.html 1. shell判断文件,目录是否存在或者具有权限 2. #!/bi ...

  7. shell 判断文件、目录是否存在

    shell判断文件是否存在   1. shell判断文件,目录是否存在或者具有权限 2. #!/bin/sh 3. 4. myPath="/var/log/httpd/" 5. m ...

  8. Shell 判断文件或文件夹是否存在

    #shell判断文件夹是否存在 #如果文件夹不存在,创建文件夹 if [ ! -d "/myfolder" ]; then mkdir /myfolder fi #shell判断文 ...

  9. shell判断文件夹是否存在

    #shell判断文件夹是否存在 #如果文件夹不存在,创建文件夹 if [ ! -d "/myfolder" ]; then mkdir /myfolder fi #shell判断文 ...

随机推荐

  1. hdu 5113(2014北京—搜索+剪枝)

    题意:有N*M的棋盘,用K种颜色去染,要求相邻块不能同色.已知每种颜色要染的块数,问能不能染,如果能,输出任一种染法. 最开始dfs失败了- -,优先搜索一行,搜完后进入下一列,超时.本来以为搜索不行 ...

  2. 4999: This Problem Is Too Simple!

    Description 给您一颗树,每个节点有个初始值. 现在支持以下两种操作: C i x(0<=x<2^31) 表示将i节点的值改为x. Q i j x(0<=x<2^31 ...

  3. win7+Apache 设置域名指向本地文件夹

    实现:浏览器地址栏输入 www.bnzoo.com 访问 D:/www 系统:win7旗舰版+Apache 步骤: 1.打开文件 C:\Windows\System32\drivers\etc\hos ...

  4. C语言程序设计第二次作业——顺序结构

    (一)改错题 1.输出带框文字:在屏幕上输出以下3行信息. 错误信息1: 错误原因:i和d位置错误 改正方法:i和d位置互换 错误信息2: 错误原因:\n后缺了一个" 改正方法:\n后加一个 ...

  5. Padding Oracle攻击

    最近在复现LCTF2017的一道题目,里面有一个padding oracle攻击,也算是CBC翻转攻击,这个攻击主要针对CBC加密模式的 网上有关这个攻击的博客文章很多,但是其中有一些细节可能是个人的 ...

  6. JAVA 访问WebRoot下的目录文件

    转自 http://blog.csdn.net/jian_csdn/article/details/46119313 ClassLoader classLoader = Thread.currentT ...

  7. 一个成功的 Git 分支模型(适用于商业应用开发)

    在这篇文章中,我将推广一下大约一年前我介绍过的一些项目(公私皆有)中使用的开发模型,它们的结果都非常成功.有段时间我非常想写出来分享一下,但是我至今才抽出时间来.我不会言及任何项目细节,仅讨论分支策略 ...

  8. Mysql--七种 Join 查询

    Mysql 系列文章主页 =============== 1 准备数据 1.1 建立 Employee 表 DROP TABLE IF EXISTS employee; CREATE TABLE IF ...

  9. swiper实现臭美app滑动效果

    一.臭美app效果: 我的需求是这样,上面正常滑动,点击下面的小卡牌,上面的滑动区也随之切换到当前的点击态. 二.实现: css: 主要设置可见区域的几张卡牌的位置,注意的几个位置是,中间的激活态和左 ...

  10. 百度音乐flac 下载

    破解百度音乐白金会员 为了给Play Music上传标签齐全的正版的mp3,本屌翻遍网络苦思冥想.现在终于被我找到了破解之法——破解百度白金会员!破解之后可以直接从百度下载正版授权的320k文件,更可 ...