Bash
emptydir() in Bash: Check Whether a Directory Is Empty
Test whether a directory is empty in pure Bash with nullglob and dotglob, handle hidden and unreadable directories, and know when find -quit is faster.
Topic
Test whether a directory is empty in pure Bash with nullglob and dotglob, handle hidden and unreadable directories, and know when find -quit is faster.
Get the directory part of a path in pure Bash, matching coreutils dirname on trailing slashes, bare names and the root, without starting a process.
Get the file name from a path with parameter expansion, matching coreutils basename on trailing slashes, "/" and suffixes, without starting a process.