Well after a long time of not thinking about this I was poking around and found the
readlink command:
Code:
$readlink --help
Usage: readlink [OPTION]... FILE
Display value of a symbolic link on standard output.
[...]
The awk method does work and for more that just the question I had. But for finding the target of a symlink I think this works better. (Much simpler, easyer to read, remember what it does in a script, etc.)
Also it is contained in the
coreutils package (Ubuntu) so most if not all distros will have it.