linux shell 判断文件是否存在等符号
-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 判断文件是否存在等符号的更多相关文章
- Linux shell判断文件和文件夹是否存在
shell判断文件,目录是否存在或者具有权限 #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/acc ...
- [转] Linux shell判断文件和文件夹是否存在
shell判断文件,目录是否存在或者具有权限 #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/acc ...
- linux shell判断文件,目录是否存在或者具有权限
在linux中判断文件,目录是否存在或则具有的权限,根据最近的学习以及网上的资料,进行了以下的总结: #!/bin/sh myPath="/var/log/httpd/" myFi ...
- Linux shell判断文件和文件夹是否存在(转发)
#!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/access.log" #这里的-x 参数 ...
- Linux Shell 判断块设备节点是否存在
/************************************************************************* * Linux Shell 判断块设备节点是否存在 ...
- shell判断文件是否存在
转自:http://www.cnblogs.com/sunyubo/archive/2011/10/17/2282047.html 1. shell判断文件,目录是否存在或者具有权限 2. #!/bi ...
- shell 判断文件、目录是否存在
shell判断文件是否存在 1. shell判断文件,目录是否存在或者具有权限 2. #!/bin/sh 3. 4. myPath="/var/log/httpd/" 5. m ...
- Shell 判断文件或文件夹是否存在
#shell判断文件夹是否存在 #如果文件夹不存在,创建文件夹 if [ ! -d "/myfolder" ]; then mkdir /myfolder fi #shell判断文 ...
- shell判断文件夹是否存在
#shell判断文件夹是否存在 #如果文件夹不存在,创建文件夹 if [ ! -d "/myfolder" ]; then mkdir /myfolder fi #shell判断文 ...
随机推荐
- 51 nod 1421 最大MOD值
1421 最大MOD值 题目来源: CodeForces 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 有一个a数组,里面有n个整数.现在要从中找到两个数字(可以 ...
- ●SPOJ 1811 Longest Common Substring
题链: http://poj.org/problem?id=2774 题解: 求两个字符串(S,T)的最长公共子串.对 S串建后缀自动机.接下来就用这个自动机去求出能和 S串匹配的 T的每一个前缀的最 ...
- 2017ACM/ICPC广西邀请赛-重现赛 1004.Covering
Problem Description Bob's school has a big playground, boys and girls always play games here after s ...
- Vue2学习(2)
按键修饰符 还可以自定义按键修饰符别名,通过全局 config.keyCodes 对象设置: // 可以使用 `v-on:keyup.f1` Vue.config.keyCodes.f1 = 112 ...
- jquery easyui datagrid设置行样式 不可删除某行
rowStyler: function (index,row) { if (parseInt(row.ksrs) > 0) { return 'color:red'; } }, onLoadSu ...
- Tomcat出现validateJarFile-jar not loaded问题
tomcat启动时问题: validateJarFile(...\WEB-INF\lib\servlet-api.jar)-jar not loaded. See Servlet Spec 2.3, ...
- logback 三
一.LoggerFactory.gerLogger()使用: private Logger vitalLogger= LoggerFactory.getLogger("vitalReques ...
- 初识Redis系列之四:.net使用Redis存储数据
首先Redis在Windows上的安装前面的文章已经介绍过,这里不介绍了,直奔主题, 直接来看看.net怎么使用Redis 首先需要引用redis相关的dll,两个途径,意识网上下载编译好的dll : ...
- SQL Server用户自定义数据类型
用户自定义数据类型:基于系统数据类型,由数据库管理员生成.利用系统存储过程定义用户自定义数据类型` Sp_addtype [@typename=] 新数据类型名, [@phystype=] 系统数据类 ...
- centos6 网卡配置,多IP设置
##云服务器 centos6网卡配置 #设置出口IP vim /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=seth0 #网卡名称 BOOTPROTO ...