linux shell判断目录是否为空的函数
时间:2015-05-13 22:33 来源:linux.it.net.cn 作者:IT
linux shell判断目录是否为空的函数:
Folder_DEPLOY="/home/user/log"
#判断目录是否为空的函数
function checkDerectory() {
if [ "`ls -A $Folder_DEPLOY`" = "" ]; then
//do something
echo true
else
//do something
echo false
fi
}
调用函数:
shell部分:
derecResult=$(checkDerectory)
if $derecResult ; then
//do something
fi
(责任编辑:IT)
linux shell判断目录是否为空的函数: Folder_DEPLOY="/home/user/log" #判断目录是否为空的函数 function checkDerectory() { if [ "`ls -A $Folder_DEPLOY`" = "" ]; then //do something echo true else //do something echo false fi } 调用函数: shell部分: derecResult=$(checkDerectory) if $derecResult ; then //do something fi (责任编辑:IT) |