mirror of
https://github.com/notwa/rc
synced 2024-11-05 07:19:02 -08:00
14 lines
432 B
Bash
Executable file
14 lines
432 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# compat: +ash +bash -dash -hush +ksh -mksh -oksh +osh -posh -yash +zsh
|
|
|
|
is_empty() { ### @-
|
|
### return 0 if the directory given by argument is empty.
|
|
while read -r f; do
|
|
[ ! -d "$f" ] && [ -s "$f" ] && return 1
|
|
done < <(find ${1:-.})
|
|
# TODO: done < <(find ${1:-.} -type f -print -quit)
|
|
# this needs to skip empty files as well.
|
|
return 0
|
|
}
|
|
|
|
[ -n "${preload+-}" ] || is_empty "$@"
|