Live data from Hacker News

I always forget the argument order of the `ln -s` command

reddit.com

121–127 of 127 posts

Re: I always forget the argument order of the `ln -s` command

#121
post #79
post #76

Earlier quoted context omitted.

My first car (a 1967 Dodge Monaco) had 'backwards' lug nuts on the left hand side of the car... http://en.wikipedia.org/wiki/Lug_nut#History Propane tanks also used to have backwards screwing connections. I believe this was a safety 'feature' given the mainstream use of small propane tanks. Having them tighten counter-clockwise prevents similar looking but wrong hoses from being attached to the tank. It also tricked…

Cars generally still do have backwards nuts on the LHS. Something about vibration and direction of turn. Some of the other bolts on the LHS can be that way too. Same with some of the LP gas cylinders I have encountered here in Aus.

Nah. I used to change tyres for a living and I never came across a car with backwards nuts on either side.

Re: I always forget the argument order of the `ln -s` command

#122
I think the source of confusion is that linking is closely associated with chains. When you add a link to a chain you always add the new link to the existing chain or

ln -s new_link (onto) existing(chain)

Obviously the target isn't a chain but the association between links and chains is a strong one.

In other words I don't think of creating a link as creating something new _from_ something that already exists, I think of it as adding something new _to_ something that already exists.

Re: I always forget the argument order of the `ln -s` command

#124
post #2

I used to have this problem. Then I realized that if I want to really copy a file, I type $cp file_from file_to and that $ln -s link_from link_to has a very similar effect to the cp command above. I haven't messed this up ever since.

This phrasing confused me more. `$ ln -s link_from link_to` would imply the reverse behavior. How does a symlink point from the actual file to the thing-that-looks-like-a-file-but-is-really-a-symlink? The file doesn't even know whether there are symlinks pointing to it. Applying your definitions of "link from" and "link to", this: Google http://google.com/>Google ; creates a link from google.com to the hyperlink on y…

That's exactly how I remember it too

  ln -s 'the one that exists' 'the one that doesnt exist'
I actually say that to myself as I'm typing the command. Since I started doing that, I've never gotten it wrong.

Re: I always forget the argument order of the `ln -s` command

#126
post #88

Earlier quoted context omitted.

That's the reason behind a most of the argument orders in the Haskell standard library: To ease Currying.

Why did you do that? Now I really want to implement a const and flip for text arguments :)

That could be a nice command line tool. Please include a Data.Function.on, and find a way to make it useful.

flip would actually be quite useful for me on grep. I often search the some corpus of text, but change the pattern.

Re: I always forget the argument order of the `ln -s` command

#127
post #10

Does anyone know why C calls like 'strcpy' and 'strcat' are the opposite of this? strcat(target, source) strcpy(target, source) But, in SH... cp source target I feel like these things were developed around the same time, by the same community. I've always wondered if there was a reason for the different perspective.

I always think that you get strcpy by first writing

   *target = source*
Step two is realizing that things don't work that way in C. Step three is sprinkling in semantic sugar to make it work.

strcat, then, is for symmetry with strcpy.

Post reply on HN