脚本 获取一个目录下各子目录中的文件个数

#!/bin/sh
find /tmp/homework -maxdepth 1 -type d | while read dir; do
count=$(find "$dir" -type f | wc -l)
echo "$dir : $count"
done

linux bash shell 判断目录是否为空的函数

#!/bin/sh
##方法一 判断输出字符数统计为0
is_empty_dir(){
return `ls -A $1|wc -w`
}
##方法二 判断输出string为空
#is_empty_dir(){
# return $[ -z `ls -A $1` ]
#}
if is_empty_dir $1;then
echo " $1 is empty"
else
echo " $1 is not empty"
fi

最新文章

  1. html之长文本框置顶
  2. 前端 时间个性化 插件 jquery.timeago.js
  3. windows docker测试二 下载container
  4. 三种ViewController跳转的异同
  5. APP国际化
  6. Shell遍历文件的每一行[转载]
  7. WordPress定位当前使用模版
  8. [Leetcode][019] Remove Nth Node From End of List (Java)
  9. Extending your SharePoint 2007 site with Microsoft ASP.NET AJAX 3.5
  10. 【C语言】指针模块
  11. Spring实战——Profile
  12. ecshop收货地址货到付款修改
  13. HDU 5752 Sqrt Bo【枚举,大水题】
  14. python3脚本打开摄像头
  15. 编写输出“Hello world”
  16. 关于lower_bound( )和upper_bound( )的常见用法
  17. _quest_random
  18. Django框架知识点整理
  19. WPF路由事件学习(一)
  20. Maven 仓库之阿里云镜像配置

热门文章

  1. stm32.cube(一)——系统架构及目录结构
  2. Winsock2使用记录
  3. Redux 原理和简单实现
  4. html-新闻滚动条
  5. Go语言设计模式之函数式选项模式
  6. 使用Python操作InfluxDB时序数据库
  7. Steam游戏《Northgard(北境之地)》修改器制作
  8. PyTorch 神经网络
  9. IoU、GIoU、DIoU、CIoU损失函数
  10. 国内操作系统OS分析(下)