linux shell判断目录是否为空的函数
2014-02-19 10:08
393 查看
linux shell判断目录是否为空的函数:
Folder_DEPLOY="/usr/local/deploy"
#判断目录是否为空的函数
function checkDerectory() {
if [ "`ls -A $Folder_DEPLOY`" = "" ]; then
//do something
echo true
else
//do something
echo false
fi
}
调用函数:
shell部分:
derecResult=$(checkDerectory)
if [[ $derecResult == true ]]; then
//do something
fi
说明:该方法是实际工作中自己用到的方法,先将其抽取出来,希望对有需要的朋友有些帮助。
Folder_DEPLOY="/usr/local/deploy"
#判断目录是否为空的函数
function checkDerectory() {
if [ "`ls -A $Folder_DEPLOY`" = "" ]; then
//do something
echo true
else
//do something
echo false
fi
}
调用函数:
shell部分:
derecResult=$(checkDerectory)
if [[ $derecResult == true ]]; then
//do something
fi
说明:该方法是实际工作中自己用到的方法,先将其抽取出来,希望对有需要的朋友有些帮助。
相关文章推荐
- linux shell判断目录是否为空的函数
- 写了两个判断文件目录是否存在的函数
- Linux Shell命令中判断目录下是否存在已知后缀名文件的命令
- linux bash shell 判断目录是否为空的函数
- Linux shell判断文件或目录是否存在
- linux shell判断文件,目录是否存在或者具有权限
- C语言判断文件夹或者文件是否存在以及权限等信息access函数和删除文件或目录 remove()函数使用实例
- linux shell 中判断文件、目录是否存在
- linux shell 学习之路---test判断是否为目录
- php中判断文件空目录是否有读写权限的函数代码
- Linux shell脚本判断输入目录是否存在,并输出目录所在磁盘使用量
- Linux Shell命令中判断目录下是否存在已知后缀名文件的命令
- 写了两个判断文件目录是否存在的函数
- PHP - Manual手册 - XL. Filesystem 文件系统函数 - is_dir判断给定文件名是否是一个目录
- Linux shell 中判断一个变量是否为空 的方法
- 判断目标目录是否存在如果不存在则新建之
- Node.js 中fs.access() 判断文件和目录是否存在;
- JavaScript判断输入是否为正整数、浮点数等数字的函数
- c++判断本地目录或本地文件是否存在linux