# !/bin/bash
current_path=`pwd`
output_dir()
{
dir=$1 #dir is a globle varible
elements=`ls $dir`
echo "$2""+"${dir##/*/} #get the dir name, remove the path
for each in $elements
do
if [ -d $1"/"$each ]
then
output_dir $1"/"$each "$2"" " #here, dir will be changed, and be used in the outloop
else
echo "$2"" " $each
fi
done
}
output_dir $current_path "" # first para is directory, second para is space显示目录结构的shell脚本
最新推荐文章于 2024-08-09 12:15:46 发布
6016

被折叠的 条评论
为什么被折叠?



