歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> 列出目錄樹

列出目錄樹

日期:2017/2/27 14:27:35   编辑:更多Linux
  下面的短小的shell程序可以列出目錄樹, 充分利用了sed強大的模式匹配能力.   目錄樹形式如下:   .   `----shellp   `----updates   `----wu-FTPd-2.4    `----doc    `----examples    `----src    `----config    `----makefiles    `----support    `----makefiles    `----man    `----util   腳本如下:   #!/bin/sh   # dtree: Usage: dtree [any Directory]   dir=${1:-.}   (cd $dir; pwd)   find $dir -type d -print sort -f sed -e "s,^$1,," -e "/^$/d" -e "s,[^/]*/([^/]*)$,`----1," -e "s,[^/]*/, ,g"




Copyright © Linux教程網 All Rights Reserved