forked from jinxv1987/profile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtree.sh
More file actions
20 lines (20 loc) · 511 Bytes
/
tree.sh
File metadata and controls
20 lines (20 loc) · 511 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#-------------------------
#!/bin/sh
#save as tree.sh, and chmod +x tree.sh , run it.
cd ./$1
pwd
find ./ -name "*" -o -name ".*" 2>/dev/null |sed -e 's/^\.//' |sed -n '2,$p' | while read line
do
a=`echo $line |awk -F\/ '{print NF}'`
a=$((a-2))
i=1
case $a in
0) echo $line |sed -e 's/\//|---/' ;;
*) while [ ! $i -gt $a ]; do
line=`echo $line |sed -e 's/\/[^\/]*/|/'`
i=$((i+1))
done
echo $line |sed -e 's/\//|---/' -e 's/ *//g';;
esac
done
#-------------------------