Live data from Hacker News

Become Shell Literate

drewdevault.com

1–10 of 341 posts

Re: Become Shell Literate

#2
cpio is the better tool for the job in the last example, compared to tar. You don't have to use xargs, for one. It's safer to use `find -0 | cpio -0o` because it can handle weird filenames that contain newlines or other spaces.

Re: Become Shell Literate

#3
I agree with the thesis but if you're taking this approach with vim it's very much worth being aware of how to use the quickfix and/or location buffers so you can easily step between the things that you've found.

If you put a bunch of location-prefixed lines in a vim buffer (either from running a command within vim or by piping to `vim -`) you can get them in your quickfix buffer with `:cbuffer!` and then step between locations with `:cnext` and `:cprev` (one of the few things my top-level .vimrc does is bind these to tab and shift-tab, respectively).

Re: Become Shell Literate

#4
I wish that shell would be more sane.

I don't think that a shell should be a complete programming language. If you need a programming language, then better use one. There is xonsh if you are looking for something like this.

I think there should be a better bash with an very clean and consistent interface. Some of the most commonly used utils like awk '{ print $2}', sed, grep, sort, ... should be included out of the box to improve performance and to provide consistency across distributions.

Re: Become Shell Literate

#5
Hear hear! I remember a senior dev at my first job being stymied by the command line; he was very adept in the IDE, but had a hard time navigating directories. It was definitely a disadvantage when it came to getting stuff done.

One thing the author didn't cover is how you can share reified knowledge when you write shell scripts. (It's the same with other programming languages, but they aren't as easy to write or modify.) That is really really powerful, because you can not only share it with others but also with your future self.

I wrote about this more here: https://letterstoanewdeveloper.com/2019/02/04/learn-the-comm...

Re: Become Shell Literate

#6
post #4

I wish that shell would be more sane. I don't think that a shell should be a complete programming language. If you need a programming language, then better use one. There is xonsh if you are looking for something like this. I think there should be a better bash with an very clean and consistent interface. Some of the most commonly used utils like awk '{ print $2}', sed, grep, sort, ... should be included out of the b…

If the data is small, then expressivness is more important. If the data is large, then multiple processes connected by pipes lets you employ more CPUs.

Re: Become Shell Literate

#8
post #6
post #4

I wish that shell would be more sane. I don't think that a shell should be a complete programming language. If you need a programming language, then better use one. There is xonsh if you are looking for something like this. I think there should be a better bash with an very clean and consistent interface. Some of the most commonly used utils like awk '{ print $2}', sed, grep, sort, ... should be included out of the b…

If the data is small, then expressivness is more important. If the data is large, then multiple processes connected by pipes lets you employ more CPUs.

Have to pull this old chestnut out: https://adamdrake.com/command-line-tools-can-be-235x-faster-...

I am not the author of that piece, but the analysis is wonderful.

Re: Become Shell Literate

#9
post #4

I wish that shell would be more sane. I don't think that a shell should be a complete programming language. If you need a programming language, then better use one. There is xonsh if you are looking for something like this. I think there should be a better bash with an very clean and consistent interface. Some of the most commonly used utils like awk '{ print $2}', sed, grep, sort, ... should be included out of the b…

> I don't think that a shell should be a complete programming language.

What do you mean exactly? If you have pipes and lists (e.g., the lines on a file) you are Turing-complete and people can and will make arbitrary programs. How would you like, precisely, to restrict the shell language so that it is not Turing-complete?

Re: Become Shell Literate

#10
> "Shell literacy is one of the most important skills you ought to possess as a programmer. The Unix shell is one of the most powerful ideas ever put to code, and should be second nature to you as a programmer. No other tool is nearly as effective at commanding your computer to complex tasks quickly — or at storing them as scripts you can use later."

I'm not going to disagree.

However...the presenter would be wise to spend a paragraph or two about actual benefits. In addition, tell us why I should listen to you. You don't persuade others with subjectivity and finger waving. Even something as simple as "...during my ten years as a software engineer..."

Otherwise, this is more rant than educational. Sorry, but I see this pattern far too often and am hoping to nudge someone here away from it.

Post reply on HN