#!/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 605dgfffffffffffffffffffffffffffff ... -
unix
2012-06-19 17:41 0fetgggggggggggggggggggggggggggg ... -
checkout.sh
2012-06-19 17:32 749ME=checkout.sh #echo - Check f ... -
gbuild.sh
2012-06-19 17:29 971ME=gbuild.sh #echo - Check for ... -
xbuild.sh
2012-06-19 17:25 950ME=xbuild.sh #echo - Check for ... -
build.sh
2012-06-19 17:21 797ME=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 765#! /bin/sh #################### ... -
tool.ksh
2012-06-06 10:34 622#! /bin/sh ################## ... -
Question
2012-05-08 13:56 6521. java存在内存泄露吗?什么情况下会出现? 2. ind ... -
Unix kshell fragments arrangement
2012-05-08 11:24 585RESP="" 判断是否为空 : if [ ...
相关推荐
format_mallocdebug_op.ksh mallocdebug后格式化输出堆栈日志
ksh-20100621-19.el6.x86_64.rpm
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
ksh-20120801-22.el7_1.2.x86_64.rpm,ksh-20120801-22.el7_1.2.x86_64.rpm
ksh-20100621-6.el6.i686.rpm
Learning KSH.doc 07/17/2009
ksh-20120801-19.el7.x86_64.rpm
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
ksh-20100621-6.el6.x86_64.rpm
ksh-20120801-10.el6.x86_64.rpm
曾经在网上寻求很久都无法找到的ksh版本,在一个ksh资源网站寻得,在此仅将苦苦寻得的两个网址分享给大家,ksh各版本rpm版相当全,如果这两个网址没有相信很难再寻求到了!!!不要50分,仅需5分即可!
Maven可执行jar骨架项目演示项目包含以下功能。 如何将本地jar安装到本地Maven存储库。 如何构建嵌入了所有依赖项.jar的可... 脚步: 运行install-jar.ksh 运行cert.ksh 运行签名并验证运行sign-jar.ksh 运行jar验证
centos系统下执行ksh文件时,需要安装相对应的ksh安装包
ksh-20080202-2.el5.i386.rpm linux装oracle用 个人备份
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
ksh-20120801-21.el6.x86_64.rpm;libaio-devel-0.3.107-10.el6.x86_64.rpm;libstdc++-devel-4.4.7-11.el6.x86_64.rpm;numactl-devel-2.0.9-2.el6.x86_64.rpm;unixODBC-2.2.14-14.el6.x86_64.rpm;unixODBC-devel...
KLE(KSH车道效果器)是JiminP(@ 123jimin)制作的程序,用于简化向.ksh图表添加车道视觉效果的过程。 安全警告 当前,该程序使用JavaScript的eval评估表达式,并且; import ; import命令可以导入系统中的任何文件...
32位版本的ksh包,适用于CentOS Linux 6.9 系统,资源为rpm格式,使用rpm -ivh 包名 安装
shell linux unix ksh
oracle安装过程中会遇到ksh-20100621包缺少,这个包解压后里面有个RPM包直接使用,可以解决这个问题