[mdlug] Painfully simple ln -s command question

Raymond McLaughlin driveray at ameritech.net
Thu Jan 28 01:42:31 EST 2010


Raymond McLaughlin wrote:
> Robert Citek wrote:
>> On Thu, Jan 28, 2010 at 12:53 AM, Raymond McLaughlin
>> <driveray at ameritech.net> wrote:
>>> MDLUGers:
>>> I have been chasing this around for over an hour, the man page is no
>>> help,  and it's bugging me.
>>>
>>> I have a directory off my home:
>>>   ~/bin .
>>> This directory contains an executable:
>>>   ~/bin/clearline .
>>> I want to create a symlink in this directory that looks like this:
>>>   bin/cln -> clearline
>>>
>>> The simplest way to just do it is:
>>>    $ cd bin
>>>    $ ln -s clearline cln
>> $ ln -snf clearnline ~/bin/cln
> 
> Thanks for the rapid reply, it works.
> 
> I saw in the man page:
>>       -n, --no-dereference
>>               treat destination that is a symlink to a directory as if it were a normal file
> 
> but it seemed to be about symlinks to directories, and I was linking to
> a regular file, so I didn't consider it. I guess I was confusing
> "destination" with "target". The info page is more informative.

No in their usage "Target" is what could be called "Source" they use the
term "LINK_NAME" ot "LINKNAME" in the documentation. From the man page:
       ln [OPTION]... [-T] TARGET LINK_NAME
I will use this terminology from here on.

> 
> Thanks
> Raymond McLaughlin

Actually the commands:

    pts/3 $ ln -s clearline bin/cln
    pts/3 $ ln -sn clearline bin/cln
    pts/3 $ ln -sT clearline bin/cln

all work. (For simplicity I've ommitted your -f switch that forces
overwriting an existing file.) My error seems to have been inclusion of
the 'bin/' directory specification in the "TARGET". This is counter
intuitive to me. 'ln' looks at the LINK_NAME to determine where to find
the TARGET. Guess I'll have to retool my intuition.

Thanks again
Ray




More information about the mdlug mailing list