1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-05-18 17:53:23 -07:00
rc/sh/is_empty
2021-07-29 00:37:35 -07:00

14 lines
312 B
Bash
Executable File

#!/usr/bin/env bash
# YES_ZSH
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.
return 0
}
[ "${SOURCING:-0}" -gt 0 ] || is_empty "$@"