${name:A}: Absolute Path with resolved links

Interprets the variable value as a file path, turns it into an absolute path and resolves symbolic links.

Use modifier :a if you would not like to resolve symbolic links.

Use modifier :P to use realpath semantics.

Examples

Convert a relative path into an absolute path with resolved links
1
2
3
cd /home/user/work
relativePath=./my-dir/sub/../my-file.txt
echo $relativePath:A
Output:
1
/home/user/work/my-dir/my_file_link_target.txt
BashSupport Pro is a Zsh IDE with support for $varName:Atry it now!
© 2020–2024 Joachim Ansorg
Imprint
Privacy Policy
Legal