summaryrefslogtreecommitdiff
path: root/tool/rmdirs
blob: 6dcf984df6df4114016ee2a2ed502b0027c2146a (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
for dir do
    while rmdir "$dir" >/dev/null 2>&1 &&
          parent=`expr "$dir" : '\(.*\)/[^/][^/]*'`; do
        case "$parent" in
        . | .. | "$dir") break;;
        *) dir="$parent";;
        esac
    done
done
true