1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-05 06:49:03 -08:00
rc/sh/is_empty

14 lines
312 B
Text
Raw Normal View History

2013-06-28 05:22:14 -07:00
#!/usr/bin/env bash
2021-07-29 00:37:35 -07:00
# YES_ZSH
2013-06-28 05:22:14 -07:00
is_empty() {
while read -r; do
[ ! -d "$REPLY" ] && [ -s "$REPLY" ] && return 1
done < <(find ${1:-.})
# 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 "$@"