Subject: Re: bug#52115: Suggestion: LN command should swap TARGET and LINK_NAME if LINK_NAME already exists

From: Bob Proulx <[email-masked]>
Date: Mon, 29 Nov 2021 15:06:26 -0700

Chris Elvidge wrote:
> Paul Eggert wrote:
> > Ulf Zibis wrote:
> > > I think, for beginners it would be less confusing, if the most
> > > simple form would be the first.
> > 
> > Unfortunately the simple form "ln TARGET" is quite rarely used, so
> > putting it first is likely to confuse beginners even more than what we
> > have already. Come to think of it, perhaps we should put the simple form
> > last instead of 2nd.

+1 for putting it last.

> I use 'ln -s "source"' quite a lot for linking into e.g. /usr/local/bin from
> my own $HOME/bin.

It defaults to "." as the target in that case.  I never liked that it
was allowed to be optional as I think it makes things much more
confusing than the two characters saved.

> The real problem could be with the terminology.
> 'ln [options] TARGET [LINK_NAME]'; the TARGET is really the source, which
> obviously must exist. A TARGET is really something you aim at.

Mostly agree.  With symbolic links the symlink contains a string.  The
string could be pretty much anything.  By convention it contains the
path to another file.  (Or to another special file.  Everything is a
file.)  But it is also used to contain a small bit of information in
other cases.  Such as for lockfiles and other uses.  Therefore source
isn't quite right.  But maybe it is good enough.  Because CONTENTS
seems less good even if perhaps more accurate.

> Perhaps it should be changed to 'ln [options] source [link]'

mv calls it SOURCE and DEST.  cp calls it SOURCE and DEST.  Perhaps ln
should also call it SOURCE and DEST too for consistency?

    cp [OPTION]... [-T] SOURCE DEST
    mv [OPTION]... [-T] SOURCE DEST
    ln [OPTION]... [-T] SOURCE DEST

I like the consistency of that.

Although I don't like that -T is not apparently an OPTION.  It's not?
Why not?  Shouldn't that synopsis form simply be these?

    cp [OPTION]... SOURCE DEST
    mv [OPTION]... SOURCE DEST
    ln [OPTION]... SOURCE DEST

Bob