Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建了一个基于树脚本的 shell 脚本,但是,我需要一种方法来使所述脚本显示文件和目录(顺便说一下:我需要脚本在 Mac OS X 上运行。)
替换ls -R | grep ':$'为find . -print,然后调整sed命令以反映名称不会添加“:”,并且 find 将显示当前目录:
ls -R | grep ':$'
find . -print
sed
find . -print | sed -e '/^\.$/d' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'