Under Linux, readlink
reads the contents of a symlink, and readlink -f
follows symlinks to symlinks to symlinks, etc., until it finds something that isn't a symlink.
This isn't necessary for scp though: scp always follows symlinks (it always copies file content, ignoring metadata except that -p
preserves file times and modes when possible).
If you find yourself disappointed by what metadata scp can and can't preserve, I suggest using rsync. With no option, rsync copies file contents ignoring metadata. The commonly used option -a
preserves all garden-variety metadata (times, symbolic links, permissions and ownership), and there are options to preserve exotic metadata like ACLs and hard links.
scp
versions follow symlinks by default, don't they? You should check yours and maybe save yourself some work.scp -r
forces following symlinks.