No matter how many times you do it, you will have to re-learn it every single time.
No matter how many times you do it, you will have to re-learn it every single time.
It is The Worst.
It’s just the most egregious example. The difference in excess argument processing between commands is rather broad example. Is the last arg special or the first one? Grep and tar are in the majority, but cp works differently. They only make sense if you think of the power user.
That really should be a giant clue that it shouldn't be used by anyone, for any reason. "It could be that the purpose of your life is only to serve as a warning to others."
but yea, it took me many years to wire down ln's target link_name semantics for some reason.
what helped for me was to reason about the single argument form. ln -s ~/opt/junk/bin/thinger creates a link to thinger in the current directory. this single argument form is easy to remember, if you want to create a link of course you have to specify the name of the target (from which the link name will be inferred) and since it's the only argument it has to be the first one. now if you want to give it a different name, put the name in obvious still open place, the second argument.
Edit: this line of reasoning works for common usage of a lot of other utils too, like zip/tar etc. Even grep - is it grep FILE PATTERN [PATTERN ...] or grep PATTERN FILE [FILE ...] ?
ln -s /foo/bar/baz
will create a soft link in the CWD named baz, pointing to /foo/bar/baz.So you see, if you know that you can always skip the destination, then, logically, the source must be the first one!
You mean the target, but that isn’t a logically necessary consequence at all. Conceivably, `ln` could support the following two syntaxes:
ln [options] target
ln [options] link_name target
The way I remember the correct parameter order is that I remember it’s the non-intuitive one.Kind of like when my wife tells me I'm doing something wrong and she wants it to be the other way.. I know she thinks this thing is important, but can't work out which way she wants it done.
even when doing windows or embedded development with tools like visual studio or wrs tornado, i've always insisted on having mkl or cygwin for command line tasks.
I remember the times before I learned Bash and the Unix userland. Those where dark times. I was stuck on Windows 98, which I really didn’t like. It just felt so needlessly crippled. When I discovered Bash, Debian, the Unix way, it felt like a breath of fresh air.
These days I’m on macOS. And one of the best things about it is that it’s a great desktop operating system, with a Unix under the hood. The userland Apple ships is quite dated, but that’s easily solvable by installing GNU Coreutils etc via Homebrew.
If bash has something like that I’m still missing it.
Obviously the brevity of bash can be its own power.
For scripting you can always use Python, which is lightyears ahead of PS.
Anything more than trivial I do in a high level programming language like Go (previously I would use Ruby or Perl).
From everything I’ve seen PS is a nice direction to go in.
I wish there was a sudden upheaval and everybody used a shell that wasn’t so legacy-cruft-laden.
Examples: These do the same thing:
tar cfv foo.tar a b c
tar cvf foo.tar a b c
tar -cvf foo.tar a b c
This errors, trying to add foo.tar to archive v: tar -cfv foo.tar a b c