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 ...
随机推荐
- springboot admin server常用配置
Property name Description Default value spring.boot.admin.context-path The context-path prefixes the ...
- Controller Service Dao总结
今天主要学习了Controller,Service,Dao的相关知识 我的理解主要是这种,Controller主要与前台页面打交道 比方:前台页面有一个"加入用户"的提交butto ...
- 获取表单select域的选择部分的文本
body> <form action="index.php"> <select name="" id="select" ...
- Challenge-2.1.4 部分和问题
部分和问题 描写叙述 给定整数a1.a2........an.推断能否够从中选出若干数,使它们的和恰好为K. 输入 首先,输入n.表示数的个数. 接着一行n个数. (1<=n<=20,保证 ...
- 如何将自己的网站分享到QQ空间,微信,微博等等。
逛一些网站的时候经常会看到右侧挂个分享栏,让用户把自己的站分享到qq空间,微信等等,所以自己也研究了下,把他加到了自己的网站上,喜欢的可以先看看效果:去转盘网,不多说了,直接上代码: window._ ...
- RTT工程管理
一.RTT工程管理 RTT采用SCons管理工程. 本次安装版本:Python-2.7.3.1.exe,python-2.7.11.msi,scons-2.3.1-setup.exe 安装完成后,需要 ...
- redis info命令中各个参数的含义
Redis 性能调优相关笔记 2016年09月25日 15:42:04 WenCoding 阅读数:4844更多 个人分类: Redis数据库 info可以使用info [类别]输出指定类别内容i ...
- 百度富文本编辑器UEditor报【类型"Uploader"同时存在】错误
错误信息: 类型“Uploader”同时存在.... 解决方案: 方法一:将UEditor的net文件夹下的Uploader.cs文件的生成操作属性默认是“编译”,只需要将这个文件的生成操作属性改为“ ...
- C#实现反射调用动态加载的DLL文件中的方法
反射的作用:1. 可以使用反射动态地创建类型的实例,将类型绑定到现有对象,或从现有对象中获取类型 2. 应用程序需要在运行时从某个特定的程序集中载入一个特定的类型,以便实现某个任务时可以用到反射.3. ...
- mysql delimiter 存储过程
命令行登录mysql cd /d D:\database\mysql1\bin mysql.exe -P 3306 -h 127.0.0.1 -u root -p USE tbschedule del ...