For use in a shell-script, I'm looking for a commandline-way to get the destination of a symbolic link. The closest I've come so far is stat -N src, which outputs src -> dst. Of course I could parse the output and get dst, but I wonder if there is some direct way of getting the destination.
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
|
|||
|
Another option would be to use the specifically designed command |
|||
|
Portably: no luck except using heuristics to parse ls -l output, or use some systems have a There are various implementations of a
Still with zsh, you can get the absolute path of a file (removes every symlink component) with the
|
|||
|
|

findmay have some side-effects... – gerrit Sep 10 '12 at 14:20