summaryrefslogtreecommitdiff
path: root/tool/rmdirs
blob: b116898fac00c81405f82d073d9219b38cb019d5 (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