Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 操作系统 > Windows98/ME > 列目录树的SHELL脚本
【标  题】:列目录树的SHELL脚本
【关键字】:SHELL
【来  源】:http://www.cublog.cn/u/12767/showart.php?id=113152

列目录树的SHELL脚本

Your Ad Here
其实就是递归的扫描目录树
#!/bin/ksh
#The path where this script is located must be added in $PATH
#to ensure it could be called recursively.
#Feel free to use this script,it is just a practice of liuyang.
#2006-5-15,Beijing
#Usage: dtree.sh SEARCH_DIR
SEARCH_DIR=$1
PREFIX=$2
IS_LAST=$3
if [ -z $IS_LAST ]; then
  echo "`pwd`/$SEARCH_DIR"
  IS_LAST=Y
else
  echo "$PREFIX+----$SEARCH_DIR"
fi
DIRS=`ls -l $SEARCH_DIR|egrep "^d"|sed "s/.* \([^ ]*\)/\1/"`
CNT=`echo "$DIRS"|wc -l|sed "s/ *//g"`
if [ $CNT = 0 ]; then
   exit
fi
cd $SEARCH_DIR
i=0
for DIR in $DIRS
do
i=`expr $i + 1`
if [ $i = $CNT ]; then
   CHILD_LAST=Y
else
   CHILD_LAST=N
fi
if [ $IS_LAST = Y ]; then
    dtree.sh $DIR "$PREFIX     " $CHILD_LAST
else
    dtree.sh $DIR "$PREFIX|    " $CHILD_LAST
fi
done
 
shell脚本中执行另一个shell脚本:【上一篇】
shell学习:【下一篇】
【相关文章】
  • shell脚本中执行另一个shell脚本
  • Unix,linux shell 十三問
  • 面向 DBA 的 Linux Shell 脚本简介
  • [原创]VB里SHELL函数的使用示例
  • 1.认识和使用shell-<跟我学shell>
  • shell 中的for循环
  • 老大寫得看dbspaces的shell
  • eshell 里面过滤颜色控制符
  • Shell写的贪吃蛇游戏
  • ShellCode的简单原理
  • 【随机文章】
  • Hash散列算法详细解析(七)
  • NAND和NOR flash的区别
  • 白盒测试
  • 启动过程详解及故障解析(4)
  • 为什么在VC7的ATL里添加接口的时候会编译不了?
  • 实验一
  • 用 java 获得 字体列表
  • 掌上电脑与台式电脑的红外数据同步
  • 让我们一起来对VSTS扩展开发吧------制作自己的VSTS模版----第三节 VSTS模版的体系概述
  • EJB 异常处理的最佳做法(2)
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.