Symlinks (was Re: [OS X TeX] Fwd: Unwanted files have which extensions?)

Stefan Walsen stefan at walsen.net
Thu Aug 19 18:44:39 EDT 2004


Bruno Voisin wrote:
> Le 19 août 04, à 01:53, Stefan Walsen a écrit :
>> Bruno Voisin wrote [with typo edited]:
>>> I've never got the syntax of ln to work exactly as I wanted it to, 
>>> for  example specifying the name of the symlink to be different from 
>>> the name of the original file (or directory). [...]
>> It's quite simple, really:
>> You just supply the name you want the symlink to have as a second 
>> argument to ln.
>>
>>   ln -s <original> <link>
>>
>> will give you a symlink called <link> pointing to the <original>.
>> <original> can be an absolute (beginning with "/") or relative 
>> pathname, and <original>, the "link target", does not need to exist.
>> If an existing directory is given as <link>, a symlink with the name 
>> of the original will be created in the given directory.
> 
> That's where I see a problem: I expected to be able, for a directory as 
> well as for a file, to create, by using the above syntax, a symlink with 
> name different from that of the original directory. Alas, it seems 
> that's not possible.

you are - i thought i had made that clear...

> By the way, is it <link> or <original> that you meant above, in "If an 
> existing directory is given as a <link>?

i'm pretty sure i meant what i said - even after re-reading it now...

let's say your current directory is empty except for a file (or 
directory) named "foo". if you now issue the command "ln -s foo bar", 
you'll get a link called "bar" that behaves as if it were "foo".

if your directory had contained a directory called "bar" before issuing 
the command above, you'd have ended up with a link called "foo" inside 
the directory "bar".

> More explicitly, because I've the impression my explanations above are a 
> little bit obscure (I'm working very long days currently, thus I'm 
> sleep-deprived and a bit phased out): I was expecting to be able to use 
> the syntax "ln -s <original> <link>" to be able to create, in the 
> current directory, a symlink of name <link> to the directory <original> 

yes, that's right.

> (which may be an absolute or relative path if needed); however, I'm 
> under the impression that this syntax, which works for files, doesn't 
> work for directories, and that for a directory all I can use is "ln -s 
> <original>" to create, in the current directory, a symlink, of name 
> <original> (with all possible "/" in original omitted), to the directory 
> <original>. Or maybe it's needed to add or remove a "/" at the end of 
> the name of a directory, to make ln understand it's a directory?

nope.

and the nice thing is that you can't break anything, because ln, unlike 
most other unix tools, won't overwrite existing files or folders unless 
you explicitly tell it to (by specifying "-f").

I hope this clears it all up a little for you :)

Stefan
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list