日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

shell命令tree

發布時間:2023/12/13 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 shell命令tree 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在Windwows下很喜歡tree命令,在CenntOS下也有這條命令,在網上找到了源代碼和一段簡單的腳本,

完整的tree源代碼可以在這里下載:?ftp://mama.indstate.edu/linux/tree/

簡易的tree腳本如下:

#!/bin/sh ####################################################### # UNIX TREE # # Version: 2.3 # # File: ~/apps/tree/tree.sh # # # # Displays Structure of Directory Hierarchy # # ------------------------------------------------- # # This tiny script uses "ls", "grep", and "sed" # # in a single command to show the nesting of # # sub-directories. The setup command for PATH # # works with the Bash shell (the Mac OS X default). # # # # Setup: # # $ cd ~/apps/tree # # $ chmod u+x tree.sh # # $ ln -s ~/apps/tree/tree.sh ~/bin/tree # # $ echo "PATH=~/bin:\${PATH}" >> ~/.profile # # # # Usage: # # $ tree [directory] # # # # Examples: # # $ tree # # $ tree /etc/opt # # $ tree .. # # # # Public Domain Software -- Free to Use as You Like # # http://www.centerkey.com/tree - By Dem Pilafian # #######################################################echo if [ "$1" != "" ] #if parameter exists, use as base folderthen cd "$1"fi pwd ls -R | grep ":$" | \sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' # 1st sed: remove colons # 2nd sed: replace higher level folder names with dashes # 3rd sed: indent graph three spaces # 4th sed: replace first dash with a vertical bar if [ `ls -F -1 | grep "/" | wc -l` = 0 ] # check if no foldersthen echo " -> no sub-directories"fi echo exit

轉載于:https://www.cnblogs.com/java20130726/archive/2013/01/29/3218684.html

總結

以上是生活随笔為你收集整理的shell命令tree的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。