2013-06-28 05:22:14 -07:00
|
|
|
#!/usr/bin/env bash
|
2021-07-29 00:37:35 -07:00
|
|
|
# YES_ZSH
|
2021-07-29 05:44:12 -07:00
|
|
|
# YES_BASH
|
|
|
|
# NO_DASH
|
2021-07-29 00:37:35 -07:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
is_empty() { ### @-
|
|
|
|
### return 0 if the directory given by argument is empty.
|
2021-07-29 05:44:12 -07:00
|
|
|
while read -r f; do
|
|
|
|
[ ! -d "$f" ] && [ -s "$f" ] && return 1
|
2013-06-28 05:22:14 -07:00
|
|
|
done < <(find ${1:-.})
|
2021-07-21 15:30:05 -07:00
|
|
|
# TODO: done < <(find ${1:-.} -type f -print -quit)
|
|
|
|
# this needs to skip empty files as well.
|
2013-06-28 05:22:14 -07:00
|
|
|
return 0
|
|
|
|
}
|
2021-07-29 00:37:35 -07:00
|
|
|
|
|
|
|
[ "${SOURCING:-0}" -gt 0 ] || is_empty "$@"
|