Hacker News

New stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. The People–OK, the Men–Who Still Love Bitcoin(slate.com ↗)
    discuss
  2. Why Nothing Looks Cool Anymore(youtube.com ↗)
    discuss
  3. AAA AI – Autonomous AI agent squads for local and cloud LLMs(aaaai.me ↗)
    discuss
  4. King Ludd(astralcodexten.com ↗)
    discuss
  5. Self-generated prompt injections in compaction summaries(simonwillison.net ↗)
    discuss
  6. Show HN: A poetry site for developers – solve a code puzzle to post(developerpoetry.com ↗)
    discuss
  7. OpenSaga: Matching decompilation of the Lego Star Wars(opensaga.dev ↗)
    discuss
  8. Windows turned months of inactivity into a 7-hour update hostage situation(theregister.com ↗)
    discuss
  9. Turn off Apple Intelligence in macOS 27(discussions.apple.com ↗)
    discuss
  10. Ground Effect Vehicle(wikipedia.org ↗)
    discuss
  11. Security Review Scope for Daml: Coverage, Methods, and EVM Comparison(hacken.io ↗)
    discuss
  12. Auto approve pull requests with Jev(github.com/metalbear-co ↗)
    discuss
  13. How ISIL is using Big Tech's AI to build bombs(aljazeera.com ↗)
    discuss
  14. Migrating the GitHub Copilot Runtime to Rust, Using Copilot(github.blog ↗)
    discuss
  15. RoboHarm: Do Frontier Robot Policies Refuse Unsafe Instructions?(robocurve.org ↗)
    discuss
  16. Chat-based Large Language Models replicate the mechanisms of a psychic's con(softwarecrisis.dev ↗)
    discuss
  17. An Ode to the Owl: The Inside Story of Psygnosis(timeextension.com ↗)
    discuss
  18. The Millennium Problems for Biology(millenniumproblems.bio ↗)
    discuss
  19. Outer Billiards on the Penrose Kite: Compactification and Renormalizaiton(arxiv.org ↗)
    discuss
  20. WrathBench − an Agent Workbench for World of Warcraft(shard.page ↗)
    discuss
  21. Big Tech uses guarantees to keep $300B AI exposure off balance sheets(ft.com ↗)
    1comments
  22. Densha de Go(wikipedia.org ↗)
    discuss
  23. The First Nolan Movie: The Odyssey and the world after men change it(firstrand.co.za ↗)
    discuss
  24. The Shaky Evidence That Flock Cameras Reduce Crime Rates(reason.com ↗)
    discuss
  25. Claude Code is getting native AGENTS.md support(github.com/anthropics ↗)
    discuss
  26. Open-source AI PR reviewer that helps you ship(nitpicker.dev ↗)
    discuss
  27. An Agent's Breath. The Heart Beats by Itself, Breathing Is a Choice(piotrzientara.pl ↗)
    discuss
  28. The Cornetto Ice Cream Cone Framework for Prompting(hazn.com ↗)
    discuss
  29. Ternary-Bonsai-8B-Gguf(huggingface.co ↗)
    discuss
  30. How Efficient Is Each Type of EV Charger? (2024)(insideevs.com ↗)
    discuss

Telling a Computer to Do Things

45 pointsby 7h agowill-keleher.com
20 comments
6h agoHN ↗

Nice article about actually learning stuff and putting this knowledge to use together. Not with AI but with one’s own brain.

2h agoHN ↗

in what case jq, a specialized json tool, is more limiting than sql?

4h agoHN ↗

Good advice. I've gotten a ton of utility out of my shell without learning very many tools particularly well.

If you take nothing else away from this, memorize the syntax of one-liner for loops, it has saved me so many times.

4h agoHN ↗

Why are we assuming using the terminal is the only way of "telling a computer to do things"? Every way you interact with a machine, you are telling it to do things in theory.

For example

At a fundamental level, I wasn’t able to tell my computer to accomplish anything that involved logic or stitching together multiple programs

How can that be true if you are telling it to boot on into a os? It doesn't involve logic? Or stiching together multiple programs?

Using a shell =\= telling a machine what to do on a broad level. You are just using the abstractions provided by the os. If you mean get better at shell so you can use it more efficiently than okay cool but that doesn't someone who uses a GUI doesn't "tell" the machine what to do as much as you.

4h agoHN ↗

I was sure this article would be about how we tell computers to do things now (writing prompts to an AI in plain English). I was wrong. Interesting nonetheless.

1h agoHN ↗

LLMs solved this exact problem. Not perfectly (they can sneak in some malicious commands) but good enough for everyone. This is also mostly what non-developers mean by "vibe-coding". They can "tell the computer to do the things" they want. Previously they were limited to existing GUI applications. Now they can automate and customize their workflows as they wish and think they're a 'coder'.

4h agoHN ↗

I was pretty close in guessing what they believe was "wrong" (or really, superfluous) with their initial shell script example.

I'd even drop the "if" from their footnote version, and go with simply

  npm install || (echo "boom" && exit)

(Not exactly equivalent because there won't be an "exit" if echo fails, but it's my preferred instict over ";") Also, "(" starts a subshell, if we are being pedantic.

2h agoHN ↗

I wonder if there’s some obscure syntax for "do this if the preceding command fails and propagate its exit code". For just returning some error you can of course have something like `die("boom")` (though not as a builtin?) but sometimes it’s useful to know the exact code.

1h agoHN ↗

if table --warble farble; then :; else table_ec=$?; echo "Garble warble farble! :(" >&2; exit $table_ec; fi

Works in dash/bash/zsh at least; not 100% sure whether the behavior of $? on the command in an if test is mandated by POSIX and/or portable. Note that you can't replace the empty then-branch with a negated condition because the negation also eats the return code.

Also, absolutely correct propagation is essentially impossible (but usually not useful anyway), because some errors might be unexpected signal exits or inability to find the command in the first place, and those will get punned onto other nonzero exit codes. I forget the exact conventions OTTOMH but generally they're in the high half (≥128).

4h agoHN ↗

On the higher level question in the article of why do people not use their main languages for basic file and command management?

I believe the answer is the same as to why Python remains hugely popular despite all the well-documented shortcomings: batteries included.

Shell languages include so many neat and concise ways to execute commands, deal with their input, output and exit codes, allow simple traversal of deep directory structures with globs and advanced tools like 'find' or 'xargs', that everything else is very unergonomic.

And niche by default (until it gets used widely enough), so even your LANG-OF-CHOICE-expert you recruit, they will not know a thing about that shell-focused library in LANG-OF-CHOICE.

3h agoHN ↗

That philosophical point about what it even means to "tell a computer to do things" is a good one. Sure, clicking around in a GUI is also telling the computer what to do. But there's a huge difference between using someone else's abstraction and building your own from scratch. The article is about that second part - the ability to throw stuff together however you want. With a GUI, you're stuck with whatever the designer thought of. With a shell, you can build just about anything

2h agoHN ↗

But you’re still limited by the designer of that shell? Or userspace? Or kernel? Or cpu architecture? I mean, how deep should you go before «it’s however YOU want»?

2h agoHN ↗

There are some really powerful UIs that are extremely flexible, like spreadsheets, or ComfyUI, or certain issue trackers. On the whole however I would say they all still are mostly their own interaction silos and integrations with other programs have to be explicitly built for each app.

The great thing about a shell is that you can glue together programs that don't know about each other. This is not a silver bullet, with shell programs being text oriented etc., but it does give rise to some powerful possibilities that don't really work with UIs.

2h agoHN ↗

Your next homework assignment is to write your own scripting language that emits asm. Then you'll be one step closer to understanding what it really means to tell your computer to do things!

2h agoHN ↗

There is, of course, a programming language designed to do shelly things as succinctly as a shell script: Perl.

1h agoHN ↗

I was amused to see DeepSeek using it recently, as I didn't realize it was installed on my machine (macos with brew).

Ruby is much, much prettier for similar purposes though, and so that's what I'll learn if I ever need to do this more frequently.

32m agoHN ↗

I disagree on the premise that the author is "using" shell. Often when reading about why the command line / shell is better than GUI, the salient advantage comes down to one thing, scripting. Yet scripting in an IDE, which is a GUI, is a ton easier than in vim, simply because the surface for discovery of actions is much more transparent.

If scripting were to be excluded, the belittling of GUIs falls a bit flat. I'd like to see graphic design work be done via CLI.

3m agoHN ↗

IMO, a scripting language is the lesser contributor to the power of shell scripting. My ranked-order is:

1. Universal Inter-Process Interface: Arbitrary program composition via the Standard Input / Output / Error interface, and "everything is a file" abstraction... None of the rest is possible without some such core design decision ("everything is an object" is the fraternal twin).

2. Widespread standard utilities: The broad availability of core util tools designed to cooperate via the same abstraction is a close second. Along with some default scripting language, that is also built for the same computing model.

3. Language of choice: Important for ease of access, but a distant third in terms of raw power, be it bash, perl, awk, node, clojure (babashka) etc. That's icing on the cake, because if one had no choice in the matter, the shell program would still be awesomely powerful. Proof is in the pudding---"scripts that matter" are always /bin/sh.

Generally speaking, the pain of learning to avoid sh and bash footguns is primarily a matter of some basic research reading: manuals, lore, and warnings (I love BashPitfalls). Well, either that, or learning the hard way by copy-pasting code, and if luck runs out, rm -rf ing something you shouldn't have.

There is no substitute to taking the day or so to read the manual, so you know it's a lot, but it ain't magic, and you can eat that elephant one bite at a time, at your own pace. Seriously... the wall-clock time learning to use (and then having to re-learn every so often) the python or node or whatever ecosystem without losing it, is nothing compared to a day of trial and error with BashPitfalls. The latter knowledge is stable and my Bash program will keep working the same way, forever, practically speaking.