getabspath and getcleanpath

getabspath is a function for shell scripts that’s intended to get the strict absolute form of a path (strict in a sense that the resulting path would remain consistent even if another item is appended unto it), without relying on an external command if possible.

getcleanpath is similar to getabspath but it doesn’t rely on the format of its input path to produce the output path. The output path is like the output of of realpath. It would never end in / unless it’s the root directory itself.

The files in the repository contain functions that would work for many types of shells.

You can check the repository of getabspath and getcleanpath in Github.