#!/bin/bash

tab="\t"
pipe="|"
dash="--------"
fmt="$pipe${dash}"
lsallfile () {
for i in ${1}/*
do
    if [ -f "$i" ]
    then
        echo -e "$fmt${i##*/}"
    elif [ -d "$i" ]
    then
        echo -e "$fmt${i##*/}/"
        fmt="$pipe$tab$fmt"
        echo -e "${fmt%$dash}"
        lsallfile ${i}
        echo -e "${fmt%$dash}"
        fmt=${fmt#"$pipe$tab"}
    fi
done
}
if [ -z $1 ]
then
    lsallfile .
else
    lsallfile $1
fi

相关文章:

  • 2021-12-19
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-18
猜你喜欢
  • 2022-12-23
  • 2021-11-27
  • 2021-12-31
  • 2022-12-23
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案