LWN.net Logo

Advertisement

Advanced thin client solution for Linux, based on Open Source. Mix Windows and Linux applications on the same desktop.

Advertise here

How Do I Make This Hard to Misuse?

How Do I Make This Hard to Misuse?

Posted Apr 7, 2008 14:38 UTC (Mon) by nix (subscriber, #2304)
In reply to: How Do I Make This Hard to Misuse? by liljencrantz
Parent article: How Do I Make This Hard to Misuse?

So do I, but I think that's because of overexposure to C, where that sort 
of thing is helpfully always the other way around.

If you think about it, ln(1) is perfectly consistent with cp(1): it 
creates or updates (for directories) the last thing you list.


(Log in to post comments)

How Do I Make This Hard to Misuse?

Posted Apr 7, 2008 17:17 UTC (Mon) by vmole (subscriber, #111) [Link]

It's consistent, kinda. The problem comes when describing: "cp foo bar" translates as "copy _foo_ to _bar_" okay, but the obvious translation of "ln foo bar" to "link _foo_ to _bar_" doesn't; the latter seems to say _bar_ is the original, at least to my taste. You have to process it as "create a link to _foo_ named _bar_". Or just memorize it. :-)

How Do I Make This Hard to Misuse?

Posted Apr 8, 2008 8:24 UTC (Tue) by IkeTo (subscriber, #2122) [Link]

> but the obvious translation of "ln foo bar" to "link _foo_ to _bar_" doesn't

I see this problem as an inaccuracy of the translation "link _foo_ to _bar_".  This seems to
imply that both _foo_ and _bar_ are pre-existing, and somehow a "link" is created between them
as a result of running the command.  Obviously not what is done by "ln".  It is instead to
"build a link to _foo_ called _bar_".  The cp is to "make a copy of _foo_ called _bar_".
Pretty consistent to me.

How Do I Make This Hard to Misuse?

Posted Apr 8, 2008 12:13 UTC (Tue) by im14u2c (subscriber, #5246) [Link]

Although, since the final argument can be a directory, perhaps the best connector for both is
"at":

Make a copy of foo _at_ bar
Make a link to foo _at_ bar

Or in the plural case:

Make copies of foo, bar, baz, quux _at_ dest
Make links to  foo, bar, baz, quux _at_ dest

How Do I Make This Hard to Misuse?

Posted Apr 9, 2008 3:06 UTC (Wed) by roelofs (subscriber, #2599) [Link]

Also keep in mind that the target for ln is optional. Thus:

   ln -s foo/bar .
   ln -s foo/bar

...are equivalent. Sadly, cp foo/bar doesn't quite work.

Greg

How Do I Make This Hard to Misuse?

Posted Apr 9, 2008 3:33 UTC (Wed) by im14u2c (subscriber, #5246) [Link]

That aspect of 'cp' always drove me nuts, probably because I learned MS-DOS first.  I've found
myself tempted to write a wrapper around 'cp' to make that form work.

I won't, though, only because I know it'll wreak havoc when I go to use someone else's account
for whatever reason.  (e.g. to show them how to do something.)

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds