Live data from Hacker News

Become Shell Literate

drewdevault.com

121–130 of 341 posts

Re: Become Shell Literate

#121

Earlier quoted context omitted.

One of the best things (in my opinion) shells could have done is do newline separated filenames instead of spaces, which would make filenames with spaces much easier to handle (you can have newlines in filenames, but in this magic world let's ban those).

That would pose problems also. The real solution, with no need to magic as you say, is to disallow spaces at the filesystem level (just like slashes and the null character are forbidden). For users typing filenames, this shouldn't be a problem, as those can be encoded e.g., as unicode's non-breaking space. Using space as a separator is a very important power, that other programming languages share. In what other prog…

> In what other programming language can you put spaces in variable names?

ISTR that many dynamic languages allow this with dynamic assignment features, but you often need to use similar dynamic access functiona rather than simple variable access to access them.

Ruby also allows whitespace if it is unicode but not ASCII whitespace, without use of dynamic assignment/access methods.

SQL allows spaces in object names but requires quoting, similar to shell.

Re: Become Shell Literate

#122
post #29

Someone should write "become IDE literate" as a response to opening of using vim with no extensions and using grep a lot. I've been using editors that are language aware since at least the late 90s. Depending on the language they'll show me all references, take me to the definition or declaration, stack those jumps so as I follow the links I can pop back a level to where I was. All of this is instant. 1000x faster th…

This speaks more to the narrowness of your view than it does about shell.

Example: I work with parallel filesystems quite a lot. Often I will need to parse through GB of logs spread across a cluster to track down a particular sequence of events for troubleshooting.

I could load up a fancy IDE with all the bells and whistles, one that instantly refactors all my 'foo', and still spend a (very) non-trivial amount of time carefully crafting (and documenting, and debugging) a proper application to solve the particular problem I'm working on.

OR - I could rattle off a pipeline using a few general tools and get the needed details in less than a minute.

You analogy about hammers is particularly amusing, invoking the old saw "If the only tool you have is a hammer, every problem looks like a nail". You take this to the absurd degree that you end up championing nail guns!

Re: Become Shell Literate

#123

I can just never get past the arg/flag inconsistency/complexity across commands. Perhaps if the docs started with a simple example of what has been seen over time to be the most common incantation for each command it might be tolerable. But as it is, I spend more time dealing with idiosyncracies of a command than I do expressively piping stuff. Perhaps if Rust had five mutually incompatible borrow-checkers which get…

You're right. I often think the man page should begin with a few examples, then launch into the neverending list of options. That is no way to learn. In foreign language 101, they start you off with a small group of examples. "Como estas?" "Muy bien. Y tu?" Afterward, they explain the rules of the language (this is a noun, this is a verb, this is how you conjugate for first-person singular, etc.). In fact, this is ho…

> The Linux man pages are upside down. Examples don't come till the very end, if at all.

man pages are meant to be a full reference, not a quick tutorial.

To get the quick tutorial others have already mentioned cheat.sh [1] and tldr pages [2] is another good resource.

[1]: https://cheat.sh/

[2]: https://tldr.sh/

Re: Become Shell Literate

#124
post #29

Someone should write "become IDE literate" as a response to opening of using vim with no extensions and using grep a lot. I've been using editors that are language aware since at least the late 90s. Depending on the language they'll show me all references, take me to the definition or declaration, stack those jumps so as I follow the links I can pop back a level to where I was. All of this is instant. 1000x faster th…

I strongly agree with this narrative and it matches my own experience. I spent 9 years of college and then grad school using exclusively either vi or emacs because I believed IDEs were a crutch that weak engineers relied upon. It wasn't until I got a real job that I found myself forced to learn a proper IDE (IntelliJ).

It blew my mind just how powerful the IDE was and how it massively increased my productivity. Putting aside code completion and code generate, I found it much easier to navigate a codebase using a proper IDE that fully understood the language. When I contrast that to my previous solution, a highly customized emacs configuration with lots of packages and my own functions, the two just don't compare.

Re: Become Shell Literate

#126
post #109

Earlier quoted context omitted.

Yup, like having a 9-in-one painter's tool vs having those 9 tools individually in a toolbox. Usually, its super convenient to have all those tools integrated because you can scrape some paint and pound a nail and pull a nail all right then and there with needing to do any swapping out or hunting for the right tool. But the instant you want to be able to hold a bolt in place with the wrench function while simultaneou…

How do you refactor, say, Java or C# or Typescript with Vim?

These days, language servers and wiring up one of the clients in Vim.

Re: Become Shell Literate

#127
post #109

Earlier quoted context omitted.

Yup, like having a 9-in-one painter's tool vs having those 9 tools individually in a toolbox. Usually, its super convenient to have all those tools integrated because you can scrape some paint and pound a nail and pull a nail all right then and there with needing to do any swapping out or hunting for the right tool. But the instant you want to be able to hold a bolt in place with the wrench function while simultaneou…

How do you refactor, say, Java or C# or Typescript with Vim?

[deleted]

Re: Become Shell Literate

#128

Earlier quoted context omitted.

Your wish has been granted: awk '{ print $2 }' can be replaced by 'cut -f2'. And all of the commands are part of the set of POSIX command-line utilities having been included on Unix systems since basically forever, with awk (the one true awk) having been introduced only in 1983 or so.

cut doesn't use the same field delimiters as awk.

And awk doesn't let you easily select a range of fields like cut

Re: Become Shell Literate

#129
post #29

Someone should write "become IDE literate" as a response to opening of using vim with no extensions and using grep a lot. I've been using editors that are language aware since at least the late 90s. Depending on the language they'll show me all references, take me to the definition or declaration, stack those jumps so as I follow the links I can pop back a level to where I was. All of this is instant. 1000x faster th…

For scriptable editors the difference is more like giving you a home depot vs a multi-feature nail gun. There're option to use other people's scripts (buy nail gun directly), or script yourself (buy parts and build your own nailing tool that suits your need, but do need to invest time in learning and building).

Re: Become Shell Literate

#130

Earlier quoted context omitted.

Where did I fault anyone, where am I gatekeeping? I'm talking about the befits of knowing more stuff. I'm not arguing against IDEs, I'm only arguing about the benefit of also knowing other stuff. Better tools: I'm very interested in, what I would in lieu of a better term describe as, Bret Victor's ideas and the example of Swift playground. At the same time, I'm very sceptic against everything that isn't a simple, hum…

By framing the IDE as a crutch, that's very much in the gatekeeping category.

I didn't mean to frame the IDE as a crutch, I'm merely saying that you should try to not let it become a crutch aka. overly rely on it.

I recently worked with a colleague who couldn't run the python program he wrote without the IDE. The IDE was not installed on the PC we were testing the program on.

He is a better programmer than me.

And I'm not saying "people who are using IDEs don't know anything".

I'm literally only talking about the benefits of also knowing some basic shell and CLI stuff.

Post reply on HN