#!/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