It's not available as a pre-defined function format like realpath()
, just because it's impossible to do in a reliable way.
As an example, on MacOS, doing ls /etc/..
, you'd think that you'd get a directory listing of /
. The thing is though that /etc
is a soft link to /private/etc
, so doing ls /etc/..
gives you a listing of /private
.
This could not be calculated in advance if the link did not yet exist, which is why there is no function that can solve it in the general sense without all files/directories already existing.
In other words, you'd most likely have to write your own function to solve your specific problem.