[X-Unix] Backup and Restore of Symbolic Links

Stroller macmonster at myrealbox.com
Thu Dec 7 23:05:28 PST 2006


On 6 Dec 2006, at 20:34, Jerry Krinock wrote:
>
> ...Here's something I figured out yesterday.
>
> Say you have a file A.txt and a symbolic link (symlink) ALink which  
> links to
> it, at the root level of your boot drive.  The data in Alink is the  
> string
> "/A.txt".

"The data in" is, if you'll excuse me saying, a poor choice of words  
for the path described by the symlink. From a program or user's point  
of view the data in Alink is whatever you see when you `cat Alink` or  
double-click on the symlink.

> ...  Say that you
> cp both A.txt and ALink to a mounted Firedrive named FW.  Now  
> doubleclick on
> the copy of Alink on FW.  Because the data in Alink is the string "/ 
> A.txt",
> you will open /A.txt on your boot drive, NOT on FW.

This is why one can describe symlinks by relative path.

Compare:

   $ ls -l bar*
   lrwxr-xr-x   1 stroller  stroller   7 Dec  8 07:02 bar -> foo.txt
   lrwxr-xr-x   1 stroller  stroller   9 Dec  8 07:03 bar2 -> ./foo.txt
   lrwxr-xr-x   1 stroller  stroller  23 Dec  8 07:03 bar3 -> /Users/ 
stroller/foo.txt
   $ pwd
   /Users/stroller
   $

HTH,

Stroller.





More information about the X-Unix mailing list