util/filepath.sh

Util functions to manipulate file paths.

filepath_base()

Return the last element on the path. If path is an empty string, the output is “.”.

filepath_dir()

Return all but the last element on path. Trailing / (one or more) are ignored. If the path is empty, return “.”.

filepath_ext()

Return the extension, i.e., text after the final dot on the last element of the path. It is empty if there is no dot.

filepath_is_abs()

Return true if the path is absolute; otherwise false.