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) |