Live data from Hacker News

Become Shell Literate

drewdevault.com

141–150 of 341 posts

Re: Become Shell Literate

#141
post #111

Fully agreed. So... As long as we're talking about the shell, when will we be able to interact with sourcehut entirely from the command line? Right now I'm particularly looking at managing build secrets. Being able to use it entirely from the command line is the only thing sourcehut lacks for it to become the best code/project/build management tool. At least for me anyway[1]; I'm aware that sourcehut's idiosyncrasies…

We have a shell for builds.sr.ht over SSH:

https://git.sr.ht/~sircmpwn/builds.sr.ht/tree/master/master-...

You can use it to, for example, do `ssh builds@builds.sr.ht submit Expaning this to support secret management would be cool.

Re: Become Shell Literate

#142
post #88

Earlier quoted context omitted.

Cant we make this argument for any level of abstraction? A lot of people start out with shells and end up being unable to understand how to construct a switch or adder in logic gates. A shell is a great tool but shouldn't be a crutch.

Emotionally, I actually agree with this. I'd love for at least a basic understanding of computers down to boolean logic and the very basics of semiconductors up to the OS level and beyond to be "widely known" by programmers and "computer literate". At the same time, I know that's extremely unreasonable to expect. I guess for the shell and editor, you can argue you ought to understand it stripped of abstractions, sinc…

As an EE and compsci major, I loved knowing how to form a transistor with n and p types, how to form NAND gates, how to deal with clocks and timing (ok, that’s a lie), how to make vhdl turn into fab rules, how cpu and system design influence compilers, how to write a compiler, various programming languages, np completeness (ok, eh), program design, architecture, distributed systems, machine learning (getting there).

The usefulness of knowing the whole stack has diminishing returns though.

It can be helpful in a large company where I can make connections that others can’t, but in a small company it’s less relevant unless I were solely focused on one specific connection (say, how machine learning using math as designed in an ALU inside a CPU or GPU is ludicrous—go analog and get four orders of magnitude speed up, all that time waiting for carry bit propagation, yuck!)

Your time is probably better spent learning to be a good generalist or specialist in your field, rather than knowing inside so many layers of abstraction.

Re: Become Shell Literate

#143

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…

This is a really big deal.

Almost nothing in computerdom was designed from a developer-centric perspective and it blows my mind.

Maybe I'm 'opposite brained' but it's the first thing that I think about when making something, sometimes at the expensive of the algorithm.

There's a bird in the back of my mind literally every time I use the shell chirping at me to translate them all into something consistent, and then make actually useful manpages for them.

The world is complicated, we have too much to learn, communications and ramp-up are essential and part of the product even if there's genius under the hood. (I'm also looking at you Rust, Git).

Re: Become Shell Literate

#144
post #48

Earlier quoted context omitted.

I totally agree that file names shouldn't have spaces because they are variables, and I (usually) name all my files with camelBackNotation names as I was taught is best practice for variable names. That said, with every command I remember running, treating the file name like a string - e.g. "file name.png" - has worked whenever I encounter spaces, no escape characters required.

The problem is shell is when I want to write something like 'find . | grep namepiece | xargs rm', or something like that. I can work around this by piling everything into the find, or in some cases by liberally spreading -0s around, but neither feel very "shell-like" to me.

Thus it seems that a filesystem that forbade spaces in its filenames would solve your problems with the shell? Sounds good to me!

Re: Become Shell Literate

#145

Piping and shell commands are powerful, but generally a bad experience. You have to plan your command, try to run it and understand how all the piping steps work. If you get it wrong, it’s an annoying experience. As an alternative, try Sublime with multiple selection (or other editors). With multiple selection skills you can transform your lines in a WYSIWYG interactive format which is much easier to work with for me…

Tips on that:

- Use "head" to reduce your data first and then quickly iterate on the pipeline. (Or sample [1] if head isn't representative; this is rare in practice)

- Use tmux (or at least 2 terminals) with shell. The left side should have your editor, and the right side should have your shell (just like the screenshot in the blog post -- that's what mine looks like too)

There is definitely a place for GUIs (IntelliJ CLion beats the GDB console for me) but you can get really far with vim, tmux, and shell.

https://unix.stackexchange.com/questions/108581/how-to-rando...

Re: Become Shell Literate

#146

Earlier quoted context omitted.

Check out my pandemic project, marcel: https://marceltheshell.org . It hits that spot you described: still a shell, but more strongly typed. Instead of bailing out and redoing everything in Python (when you reach the end of your pipeline), you can add a bit of Python code in your command. For example, find all the .py files under the current directory, find the ones that have changed in the last day, and then print t…

> Yes, this is doable with find and awk You don't even need awk for that one: grep ^class `find . -mtime -1 | grep py$` Maybe you could try to use an example where it really makes a difference? Some natural operation that would be very cumbersome with plain shell but is easy and direct with marcel. Otherwise many people may fail to see the point.

Read a CSV file, foo.csv, and sort by the sum of the 4th and 7th columns (which are integers):

    read -c foo.csv | sort (*x: int(x[3]) + int(x[6]))
I suppose we could argue about what is a "natural" operation. Marcel grew out of a set of tasks that were "natural" in the domain I was working in. An important part of that domain was operating on databases, and clusters of nodes, and databases on those nodes. So marcel has features for those capabilities.

Partly, I was also scratching an itch: I prefer using Python to exploring the sublanguages of various shell commands. Much cleaner, in my opinion.

Re: Become Shell Literate

#147
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…

1) I'm not going to teach Jenkins to use IntelliJ. I want my build step (whether gradlew or make) to be runnable in the same way as it runs in scripts. I get to set (and read!) env vars when they're right there in front of me, not hidden away behind dialog boxes.

> 1000x faster than opening a shell

Don't close the shell.

> trying to grep all the project files for word phrases which, not being language aware, can't tell if one 'foo' is relevant or irrelevant from another 'foo'.

IntelliJ is the gold standard according to my Java buddies and when I search for a class (by hitting ctrl-N ... go figure) I frequently don't get any results. Some kind of misconfiguration will silently make things not work. It happens enough that I have to second-guess its results, even when they're correct. Now I only use ctrl-N to jump back and forth between classes I know exist. Actual searches I'll leave to find/grep/ag.

Likewise when I optimistically right-click some part of my project and click 'Run all tests'... "No tests were found".

Re: Become Shell Literate

#148
post #117
post #97

Earlier quoted context omitted.

Still, a lot of people start out programming with complex compilers and end up being unable to hand-write their assembly code in pure HEX without the "help" of their compiler. Starting out, or only ever leaning a compiler is also hiding a lot of things from you. Now, I am familiar with assembly, I live and breathe it honestly, but I don't gatekeep and say "you're not a real programmer unless you've written your own a…

> Some people are happy in their IDEs and see no reason to move to the lower-level of abstraction in their tooling. True but you're also at the mercy of whatever company is responsible for developing those IDEs. I'm not advocating everyone do development in shell but I feel like you should know what's going under the hood when things go wrong.

> True but you're also at the mercy of whatever company is responsible for developing those IDEs.

With all the IDE companies being so ruthless, I wonder where are all those screwed-over IDE users running to.

Re: Become Shell Literate

#149
post #97

Earlier quoted context omitted.

Cool. Still, a lot of people start out programming with complex IDEs and end up being unable to run their code without the "play" button of their IDE. Starting out, or only ever leaning an IDE is also hiding a lot of things from you. For me, knowing the shell isn't about IDE vs. shell tooling, it's about, whatever you use, be aware and knowledgeable about the foundation and being able to do stuff even if there is no…

Still, a lot of people start out programming with complex compilers and end up being unable to hand-write their assembly code in pure HEX without the "help" of their compiler. Starting out, or only ever leaning a compiler is also hiding a lot of things from you. Now, I am familiar with assembly, I live and breathe it honestly, but I don't gatekeep and say "you're not a real programmer unless you've written your own a…

its always beneficial to learn technology at a lower level. if you are running Windows, its good to learn Powershell. if you have a refrigerator, it is good to know how to change your water filter, clean your fan etc. the purpose of the article is simply stating that familiarizing yourself with posix shells is beneficial to a modern day programmer and I don't think anyone can argue with that.

Re: Become Shell Literate

#150
I completely agree, this knowledge can be very powerful. I also want to play Celeste[0] because it looks beautiful.

But i have to say lately i dislike posts written in this command tone. Like "Do this to become X"/"Use this technology for Y"/"Don't do Z". Most of the time i end up feeling bad for not knowing something and therefore not being 10x programmer or even feeling antipathy towards the topic or author as i have different views. But in reality these things often don't matter or rather it can vary a lot person by person and context by context. You just don't need to be a shell literate to be a successful programmer. I wonder if more subtle introductions aren't better. Some which would spark interest but wouldn't leave a person with a bad feeling if he can't get into it right away.

[0] http://www.celestegame.com/

Post reply on HN