Recently Written · git

tmpl

Insanely simple templates

git clone https://github.com/equwal/tmpl

Log | Files | Refs


sh/isempty (272 bytes)

1 isempty () {
2     cd "$1"
3     umask 077 # Prevent races
4     set -- .[!.]* ; test -f "$1" && return 1
5     set -- ..?* ; test -f "$1" && return 1
6     set -- * ; test -f "$1" && return 1
7     return 0
8 }
9 # wreck permissions
10 isempty () { umask 077 ; rmdir "$1" && mkdir "$1" ; }