Live data from Hacker News

Become Shell Literate

drewdevault.com

201–210 of 341 posts

Re: Become Shell Literate

#201
post #165

Sign me up for someone who hates the shell. I've always tried to write scripts in Python or even C++ is so much easier than bash, awk, etc. Bash has no repl, no unit tests not debugger its anachronistic. Don't get me started on emacs.

Bash has no REPL?

Re: Become Shell Literate

#202
Nice post, but 2020 and still using an unauthenticated connection (plain netcat) to transfer data including executables (if I understood correctly) is not something you can justify when there are plenty of safe alternatives (e.g. wormhole, syncthing).

Maybe the recipient and the sender just compare hashes via a secure channel, but there's no mention of this.

Re: Become Shell Literate

#203
post #45
post #26

Earlier quoted context omitted.

The inconsistency sometimes bothers me too, but it makes me feel a little better to remember that so many of the CLI commands we take for granted are part of an old historical heritage. The inconsistency is part of that heritage--today's CLI wasn't designed all at once by one group, but rather evolved over 50+ years from many contributors, back when nobody expected that people would still be using `sed` in 2020. For…

(nit) > `grep --extended-regexp` but `sed --regexp-extended` Why not use `grep -E` and `sed -E`?

Hint: if you're still using grep to search files rather than a file, install and start using the "newer generation" of greps (ag, ripgrep etc). You likely won't believe the speed.

I use ag many times a day to search 10,400 files comprising about 800k lines of code, and it is in every meaningful way completely instantaneous. It also understands repository structures, and so won't waste your time there.

It seriously changed my (programming) life.

Re: Become Shell Literate

#204
post #38
post #31

I find shell literacy more important than ever as I continue to invest in CI/CD using GitHub actions. With multiple contexts, and sometimes complex behavior, leveraging shell seems key to debug and gluing things together.

Yup, it seems that shell embedded in YAML is pretty much a pattern now (Github Actions, Gitlab, Kubenetes, Travis CI, sourcehut, etc.) And I think it's growing beyond CI/CD -- that is, Github actions is a more general platform than Travis CI, etc. Good example: https://lobste.rs/s/oeelem/using_github_issues_as_hugo_front... My pet peeve is that YAML is a terrible syntax for a shell script, i.e. there are if statement…

It is not a very pretty pattern but the value on GA is so high for me these days, I just fight it until I get what I need.

I think there are probably very elegant ways to combine yaml and shell scripting, maybe by careful factoring of things into their own actions. I hope so.

I will check out oil.

Re: Become Shell Literate

#205

Earlier quoted context omitted.

Is "gatekeeping" now just another word for making people feel bad? Like "pretentious" or "elitist" has become? Nobody is saying that people with crutches shouldn't be allowed to walk. edit: It's so strange to not only demand the right to not know how to do something without a complicated tool (a right which is inalienable and not threatened), but to also demand that people who do know how to do that thing not think t…

I mean shouldn't you feel bad if you're trying to discourage active engagement in a topic if one doesn't do it in a specific "correct" way? Personally I've found a diverse set of viewpoints to be incredibly valuable on the teams I've been a part of. I have my own biases on testing, stability, performance and seeing how others approach it has broadened my understanding of how to build software. To put it another way,…

I literally said that "IDEs are great tools" and my whole argument was that people can broaden their understanding by also learning some shell in addition to their IDE.

So not sure what your point is.

Re: Become Shell Literate

#206

Earlier quoted context omitted.

Sounds like a reinforcement of Drew's point to me. Using the IDE to jump all over the place, and blast changes over several files at once, suggests severe and unnecessary non-localities and tight couplings in the code. Maybe without the IDE, the code would have ended up a little cleaner.

> Maybe without the IDE, the code would have ended up a little cleaner. When you can’t easily jump from file to file and get intellisense like completion you are forced to design modules and data models which can fit inside your head. I imagine this can be a feature in some cases and a limitation in others. I tend to only use an IDE when refactoring, and a text editor for everything else. So far I haven’t had to writ…

> I imagine this can be a feature in some cases and a limitation in others.

Technically true, but it's only a limitation in the sense that not being allowed to use asbestos shingles and lead pipes is a limitation for someone building a house.

Re: Become Shell Literate

#207
I do so much of this it would be hard to document all of them. In a very large lisp project, I had an astonishing number of lines of shell code--none more than 10 lines long. (Today I would do production automation with cl-readline and inferior-shell and uiop:launch-program.

Also, given that I use emacs, I do lots with dired, and on odd occasions eshell. And I have gathered a bit of emacs lisp code as well.

Re: Become Shell Literate

#208
post #37

Learning the shell was one of the best things I did as a programmer. It helped a lot that 15+ years ago I committed to running desktop Linux as a daily driver. Especially back then when things were much rougher on the desktop, using Linux as a daily driver means occasionally doing something in the shell. Ultimately, just like learning a programming language, one must have a practical reason, a project, to make it wor…

At least it still gives you the choice. I learned a lot by stripping down my system and removing/replacing a lot of components to the extent that it didn't resemble Fedora (or Debian, or whatever) at all anymore. The amount of stuff you learn after completely trashing your only system and needing it to be restored and usable in a few hours…

Funny, I actually learned Linux the opposite way. I started using Gentoo. I know that seems like learning Linux on hard mode, but for me it worked well. I had dabbled a bit before that, but I didn't really get Linux, before getting my hands dirty in this way.

Re: Become Shell Literate

#209
Shell is simultaneously wonderful and horrendous. Did you know that the left bracket ([) is actually not a part of bash syntax, but instead a binary that lives in /bin? Run “which [“ if you don’t believe me!

Re: Become Shell Literate

#210

Earlier quoted context omitted.

>The Linux man pages are upside down. Examples don't come till the very end, if at all. You only learn the tool once. Every subsequent time you visit the man page, the information you're probably looking for is frontloaded. Just scroll to the bottom if you want examples?

Fair points. After all, I know the keyboard shortcut to jump to the bottom (Ctrl-G).

According to less(1), the key is: “G or > or ESC->”.
Post reply on HN