shell判断文件/目录是否存在
https://www.cnblogs.com/37yan/p/6962563.html
caution!!! if should be end with fi
caution!!! there should be a space between [ and ! , also between 1 and ]
if [ ! $# -eq 1 ];then
#!/bin/bash
# 判断传入的参数的个数是不是一个
if [ ! $# -eq ];then
echo param error!
exit
fi # 判断目录是不是已经存在,如果不存在则创建,存在则输出“dir exist”
dirname=$
echo "the dir name is $dirname"
if [ ! -d $dirname ];then
mkdir $dirname
else
echo dir exist
fi
shell判断文件/目录是否存在的更多相关文章
- shell判断文件,目录是否存在或者具有权限
shell判断文件,目录是否存在或者具有权限 #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/ ...
- shell判断文件,目录是否存在或者具有权限的代码
核心代码 #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/access.log" #这里的 ...
- shell判断文件,目录是否存在或者具有权限 (转载)
转自:http://cqfish.blog.51cto.com/622299/187188 文章来源:http://hi.baidu.com/haigang/blog/item/e5f582262d6 ...
- linux shell判断文件,目录是否存在或者具有权限
在linux中判断文件,目录是否存在或则具有的权限,根据最近的学习以及网上的资料,进行了以下的总结: #!/bin/sh myPath="/var/log/httpd/" myFi ...
- 2017.8.23 shell判断文件,目录是否存在或者具有权限
#!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/access.log" #这里的-x 参数 ...
- shell 判断文件、目录是否存在
shell判断文件是否存在 1. shell判断文件,目录是否存在或者具有权限 2. #!/bin/sh 3. 4. myPath="/var/log/httpd/" 5. m ...
- Shell中判断文件,目录是否存在
一. 具体每个选项对应的判断内容: -e filename 如果 filename存在,则为真 -d filename 如果 filename为目录,则为真 -f filename 如果 filena ...
- shell判断文件是否存在
转自:http://www.cnblogs.com/sunyubo/archive/2011/10/17/2282047.html 1. shell判断文件,目录是否存在或者具有权限 2. #!/bi ...
- Linux shell判断文件和文件夹是否存在
shell判断文件,目录是否存在或者具有权限 #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/acc ...
随机推荐
- C# 版 防止 DNS 污染,获取域名真实 IP 地址
using System; using System.Collections.Generic; using System.IO; using System.Net; using System.Net. ...
- post请求与get请求
$.post('/manage.aa', function (response) { agentList = response.data; }, 'json'); var categoryId; $. ...
- struts-tiles学习笔记
网上搜了一些,稀里糊涂的,要么是代码不全,要么是版本不对,还是去struts官网大概学习了一下 http://struts.apache.org/development/1.x/struts-tile ...
- 关于引脚复用,不得不提的GPIO_Pin_sources 和GPIO_Pin
今天在端口复用时遇到了困惑,参考:http://www.51hei.com/bbs/dpj-40992-1.html 调整前的代码GPIO_PinAFConfig(GPIOA,GPIO_Pin_9,G ...
- linux学习笔记22--命令ln
ln是linux中又一个非常重要命令,它的功能是为某一个文件在另外一个位置建立一个同步的链接.当我们需要在不同的目录,用到相同的文件时,我们不需要在每一个需要的目录下都放一个必须相同的文件,我们只要在 ...
- 栈类Stack
Stack类是Vector类的子类.它向用户提供了堆栈这种高级的数据结构.栈的基本特性就是先进后出.即先放入栈中的元素将后被推出.Stack类中提供了相应方法完成栈的有关操作. 基本方法: publi ...
- Hibernate Tools插件的使用
Hibernate Tools是由JBoss推出的一个Eclipse综合开发工具插件,该插件可以简化ORM框架Hibernate,以及JBoss Seam,EJB3等的开发工作.Hib ...
- [转]软件测试- 3 - Mock 和Stub的区别
由于一直没有完全搞明白Mock和Stub的区别,所以查了很多文章,而这一篇是做好的: http://yuan.iteye.com/blog/470418 尤其是8楼,Frostred的发言,描述地相当 ...
- datagrid使用要点
table自适应: (fit:true(设置table)) 列自动撑开:fitColumns: true,注意给列的width属性赋值
- 用MathType编辑带点星号的流程
在数学中,在进行问题描述的同时,可能也会使用到一些文本符号,比如带点星号.这些符号嵌入在公式中,就需要在MathType数学公式编辑器中来编辑,而不是在文档中编辑.而对于公式编辑器来说,编辑一些常用的 ...