utility
realpath
Resolve a pathname to canonical absolute form on GNU systems. Does not guarantee that later opens refer to the same object.
Formal Syntax & Structure
bash syntaxbash
realpath -- PATHReturn Value
exit status
Resolve a pathname to canonical absolute form on GNU systems. Does not guarantee that later opens refer to the same object.
Working Example
Example Snippetbash
mkdir -p fixtureprintf x > fixture/dataln -s fixture/data linkp=$(realpath -- link) || exit 1printf '%s\n' "${p#"$PWD/"}"