The main stumbling block with splitting paths in Bash is converting a relative path into an absolute one.
Searching the Internet I found many partial solutions, but none was entirely satisfactory. There may be a better solution out there, but I didn’t find it.