#!/bin/bash
# tree.sh
# Written by Rick Boivie. Used with permission.
# This is a revised and simplified version of a script
# by Jordi Sanfeliu (and patched by Ian Kjos).
# This script replaces the earlier version used in
# previous releases of the Advanced Bash Scripting
# Guide.
# ==> Comments added by the author of this document.
search () {
for dir in `echo *`
# ==> `echo *` lists all the files in current working directory,
#+ ==> without line breaks.
# ==> Similar effect to for dir in *
# ==> but "dir in `echo *`" will not handle filenames with blanks.
do
if [ -d "$dir" ] ; then # ==> If it is a directory (-d)...
zz=0 # ==> Temp variable, keeping track of directory level.
while [ $zz != $1 ] # Keep track of inner nested loop.
do
echo -n "| " # ==> Display vertical connector symbol,
# ==> with 2 spaces & no line feed in order to indent.
zz=`expr $zz + 1` # ==> Increment zz.
done
if [ -L "$dir" ] ; then # ==> If directory is a symbolic link...
echo "+---$dir" `ls -l $dir | sed 's/^.*'$dir' //'`
# ==> Display horiz. connector and list directory name, but...
# ==> delete date/time part of long listing.
else
echo "+---$dir" # ==> Display horizontal connector symbol...
# ==> and print directory name.
numdirs=`expr $numdirs + 1` # ==> Increment directory count.
if cd "$dir" ; then # ==> If can move to subdirectory...
search `expr $1 + 1` # with recursion ;-)
# ==> Function calls itself.
cd ..
fi
fi
else
zz=0 # ==> Temp variable, keeping track of directory level.
while [ $zz != $1 ] # Keep track of inner nested loop.
do
echo -n "| " # ==> Display vertical connector symbol,
# ==> with 2 spaces & no line feed in order to indent.
zz=`expr $zz + 1` # ==> Increment zz.
done
echo `pwd`/$dir
fi
done
}
if [ $# != 0 ] ; then
cd $1 # move to indicated directory.
#else # stay in current directory
fi
echo "Initial directory = `pwd`"
numdirs=0
search 0
echo "Total directories = $numdirs"
exit 0
# tree.sh
# Written by Rick Boivie. Used with permission.
# This is a revised and simplified version of a script
# by Jordi Sanfeliu (and patched by Ian Kjos).
# This script replaces the earlier version used in
# previous releases of the Advanced Bash Scripting
# Guide.
# ==> Comments added by the author of this document.
search () {
for dir in `echo *`
# ==> `echo *` lists all the files in current working directory,
#+ ==> without line breaks.
# ==> Similar effect to for dir in *
# ==> but "dir in `echo *`" will not handle filenames with blanks.
do
if [ -d "$dir" ] ; then # ==> If it is a directory (-d)...
zz=0 # ==> Temp variable, keeping track of directory level.
while [ $zz != $1 ] # Keep track of inner nested loop.
do
echo -n "| " # ==> Display vertical connector symbol,
# ==> with 2 spaces & no line feed in order to indent.
zz=`expr $zz + 1` # ==> Increment zz.
done
if [ -L "$dir" ] ; then # ==> If directory is a symbolic link...
echo "+---$dir" `ls -l $dir | sed 's/^.*'$dir' //'`
# ==> Display horiz. connector and list directory name, but...
# ==> delete date/time part of long listing.
else
echo "+---$dir" # ==> Display horizontal connector symbol...
# ==> and print directory name.
numdirs=`expr $numdirs + 1` # ==> Increment directory count.
if cd "$dir" ; then # ==> If can move to subdirectory...
search `expr $1 + 1` # with recursion ;-)
# ==> Function calls itself.
cd ..
fi
fi
else
zz=0 # ==> Temp variable, keeping track of directory level.
while [ $zz != $1 ] # Keep track of inner nested loop.
do
echo -n "| " # ==> Display vertical connector symbol,
# ==> with 2 spaces & no line feed in order to indent.
zz=`expr $zz + 1` # ==> Increment zz.
done
echo `pwd`/$dir
fi
done
}
if [ $# != 0 ] ; then
cd $1 # move to indicated directory.
#else # stay in current directory
fi
echo "Initial directory = `pwd`"
numdirs=0
search 0
echo "Total directories = $numdirs"
exit 0
发表评论
-
unix study
2012-06-21 16:47 639dgfffffffffffffffffffffffffffff ... -
unix
2012-06-19 17:41 0fetgggggggggggggggggggggggggggg ... -
checkout.sh
2012-06-19 17:32 802ME=checkout.sh #echo - Check f ... -
gbuild.sh
2012-06-19 17:29 1007ME=gbuild.sh #echo - Check for ... -
xbuild.sh
2012-06-19 17:25 985ME=xbuild.sh #echo - Check for ... -
build.sh
2012-06-19 17:21 856ME=build.sh #echo - Check for ... -
project -lib4
2012-06-18 17:02 0dffffffffffffffffffffffffffffff ... -
prject - lib3
2012-06-18 16:55 0sdfsdgreyyyyhhhhhhhhhhhhhhhh -
prject -lib2
2012-06-18 16:52 0sddddddddddddddddddddddddf -
project1 - lib
2012-06-18 16:48 0sfffffffffffffffffff -
project1
2012-06-18 16:45 0sfsfdsfdsffdf -
build.ksh
2012-06-06 17:22 802#! /bin/sh #################### ... -
tool.ksh
2012-06-06 10:34 660#! /bin/sh ################## ... -
Question
2012-05-08 13:56 6751. java存在内存泄露吗?什么情况下会出现? 2. ind ... -
Unix kshell fragments arrangement
2012-05-08 11:24 607RESP="" 判断是否为空 : if [ ...
相关推荐
format_mallocdebug_op.ksh mallocdebug后格式化输出堆栈日志
3. **StatspackCleanup.ksh 和 statspack_cleanup.ksh**:Statspack 是 Oracle 9i 提供的一个性能分析工具,这两个脚本用于清理 Statspack 收集的旧统计信息。定期清理可以节省存储空间,并保持性能报告的时效性。...
4. rpt_sql_nohint.ksh、rpt_sql.ksh、rpt_idlm.ksh、rpt_idlm_hwm.ksh:这些都是生成不同类型的Statspack报告的脚本。"nohint"可能表示不包含SQL提示的报告,"idlm"可能涉及数据库的并发控制(如锁和事务管理)。 ...
ksh-20120801-22.el7_1.2.x86_64.rpm,ksh-20120801-22.el7_1.2.x86_64.rpm
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
ksh-20120801-10.el6.x86_64.rpm
ksh-20100621-19.el6.x86_64.rpm
1. **get_busy.ksh**:这个脚本可能用于获取系统当前的繁忙SQL语句,它能够列出执行频率高或者消耗资源多的SQL,以便进一步分析其性能问题。通过这种方式,可以快速识别出系统中的瓶颈。 2. **rpt_sql_nohint.ksh**...
ksh-20100621-6.el6.i686.rpm
【ksh-WRF 介绍】 本文将对WRF(Weather Research and Forecasting)模型中的ksh脚本程序进行简要介绍。WRF是一款开源的高级气象预报系统,它使用ksh(Korn shell)脚本来处理一系列预处理、运行和后处理任务。ksh...
ksh-20120801-19.el7.x86_64.rpm
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
根据给定文件的信息,我们可以深入探讨Korn Shell (KSH) 的关键概念和特性,这在IT行业,尤其是系统管理和脚本编程领域极为重要。以下是对文档标题、描述以及部分内容中提到的知识点的详细解析: ### 函数(Function...
ksh-20100621-6.el6.x86_64.rpm
曾经在网上寻求很久都无法找到的ksh版本,在一个ksh资源网站寻得,在此仅将苦苦寻得的两个网址分享给大家,ksh各版本rpm版相当全,如果这两个网址没有相信很难再寻求到了!!!不要50分,仅需5分即可!
《Oracle安装中的ksh-20100621包详解》 在进行Oracle数据库的安装过程中,可能会遇到一个关键的依赖问题——缺少名为“ksh-20100621”的软件包。这个包对于Oracle的顺利安装至关重要,本文将详细解析这个包的用途、...
Maven可执行jar骨架项目演示项目包含以下功能。 如何将本地jar安装到本地Maven存储库。 如何构建嵌入了所有依赖项.jar的可... 脚步: 运行install-jar.ksh 运行cert.ksh 运行签名并验证运行sign-jar.ksh 运行jar验证
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
centos系统下执行ksh文件时,需要安装相对应的ksh安装包
ksh-20080202-2.el5.i386.rpm linux装oracle用 个人备份