In zsh, yes there is.
Assuming your path is stored in a variable, you can use the :P
modifier to get the absolute path of the file.
Example:
f='../example.txt'echo ${f:P}
The above will print the absolute path of ../example.txt
.
You can alternatively use the :A
modifier to further resolve symbolic links, but this depends on realpath
being installed.
f='../example.txt'echo ${f:A}
See https://zsh.sourceforge.io/Doc/Release/Expansion.html#Modifiers