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 ...
随机推荐
- Atitit.antlr实现词法分析
Atitit.antlr实现词法分析 1.1. antlrworks-1.4.3.jar wizard1 1.2. 词法的类型 id,int,float ,comment,str,char,wh ...
- atitit.jQuery Validate验证框架详解与ati Validate 设计新特性
atitit.jQuery Validate验证框架详解与ati Validate 设计新特性 1. AtiValidate的目标1 2. 默的认校验规则1 2.1. 使用方式 1.metadata用 ...
- atitit.LimeSurvey 安装 attilax 总结
LimeSurvey 安装 (OSSEZ) CHS 技术参考, 2011-05-02 Author: YUCHENG HU, HA Websystems, Inc. 备忘 Copyright © HA ...
- json-lib解析json之二维JSONArray
在接口测试中,不管是接口的请求报文还是接口的响应报文,数据全部使用json,在工作中避免不了去解析响应报文以获取某个键的值,解析josn有两种方式,一种是利用jackson,还有一种就是利用json- ...
- JSON资料整理(转载)
目录 1.什么是json 2.json语法规则 3.json基础结构 4.json基础示例 5.JSON和XML比较 6. .NET操作JSON 原始方式 通用方式 内置方式 契约方式 通过序列化将. ...
- treeMap,key排序,value排序
HashMap与TreeMap按照key和value排序 使用一个场景是mapreduce中用解决topn问题是用value 排序 topn MapReducetopN
- 我的直播demo
推流工具: ffmpeg 接收/转发流工具: nginx-rtmp 在线播放工具: video.js -------------------------------------- demo地址: ht ...
- C++ 类模板四(typename关键字)
- 如何获得<div id=”div1”>This is first layer</div>中的值?
如何获得<div id=”div1”>This is first layer</div>中的值? 解答: <script> var div1=Document.ge ...
- java web学习笔记-jsp篇
1.java web简介 1.1静态页面与动态页面 表现形式 所需技术 静态网页 网页内容固定,不会更新 html,css 动态网页 网页内容由程序动态显示,自动更新 html,css,DB,ja ...