5 ms·
life is way too short to deal with this nightmare of a language and its 50000 footguns for anything longer than a 2 line script, especially in the age of LLMs.
by zaptheimpaler 2mo ago
life is way too short to deal with this nightmare of a language and its 50000 footguns for anything longer than a 2 line script, especially in the age of LLMs. Just write a python/TS/any real language script instead. Bash is great for the command line, it should be limited to use there.
- jghn 2mo agoIt turns out that LLMs are really good at writing bash too. even perl! maybe we should rethink some of these lost bits because we no longer need to worry about the arcane parts.
- AlecSchueler 2mo agoDefine "really good?" I don't think I've ever had them produce a script that I didn't need to correct in some way. They can write it, that's true, but we still need to be able to read it.
- jghn 2mo agoFair. I'm comparing it to the output I see generated in more mainstream, day to day, languages. I'm not going to bother to get into an argument on if the frontier models can generate amazing code in general. What I've found is I can get get the frontier models to generate bash scripts, perl one liners, etc that do exactly what I need at roughly the same quality as any other code it generates.
- AlecSchueler 2mo ago100% They're super useful and I often use them to generate bash scripts of, but that's exactly how I know how important it is to check their work! I'm a shell scripter at heart, the arcane stuff has always been a delight for me, so I've driven them to do some pretty complex stuff where previously I would have "copped out" and used python. I'd say the general adage of them being at the level of a very talent junior holds true.
- Arshad-Talpur 2mo agoI agree with you, instead of working on creating a bash script if we just sit as a senior developer ,check and correct what is needed is the way forward, it kind a remind me Pair programming when one do the scripting and other corrects it
- nullsanity 2mo ago[dead]
- nomel 2mo agoBash scripts requires "set -eu" at minimum, when written by LLM or human. It's the only language terrible enough to make the default behavior ignore undefined variables, commands, and execution errors, and happily continue executing whatever was produced by me smashing my hands on the keyboard, until the end of the file, while returning an exit code of 0, claiming complete success.
- shric 2mo ago“Only language” eh? I only have a passing familiarity or very distant memory so could be wrong but I’d say these are the same: Perl (needs use strict) Ancient VB/VBA/VB script Original PHP (no idea about modern) PowerShell Old Windows/DOS batch
- _bernd 2mo ago> Bash scripts requires "set -eu" at minimum, when written by LLM or human. No. It does not. Just write good scripts and catch errors and handle them. That's the same more less with every language. And bash can be written in a way that it is sane and readable and maintainable. Just because you have seen a lot of junk in the language does not make the language bad per se. Sure there are a lot of languages "features" which are more then questionable but I want to rise again the point that it has its place and can be used in a good way.
- valleyer 2mo agoAh yes, the Feynman Algorithm for shell scripting.
- 2mo ago
- Gigachad 2mo agoI have seen them write massively more complex bash scripts than any normal person would ever attempt, but the failure rate is absurdly high compared to when they write sane typed languages.
- garethrowlands 2mo agoI have some absolutely amazing bash scripts that I would never have contemplated making myself in bash. And they'd only have been somewhat better in python. Claude for the win!
- axus 2mo agoAn LLM taught me how to use the shell colon. Shell scripts are short enough that it's been worth my time to edit the AI's work.
- flexagoon 2mo agoJust use Fish
- lobofta 2mo agoOr better yet Nushell
- genidoi 2mo agoI find LLM's too fall into the trap of writing a bash script for a task that clearly needs to be implemented in an Actual Language with Real Data Structures. For example, ask an LLM to bring up a SQL server with some schema + data preload step, and it will write a profoundly long bash script to do that task, every time.
- IshKebab 2mo agoI think they've learnt from decades of humans using Bash for tasks that clearly need to be implemented in an Actual Language. The knowledge that Bash is awful and should be avoided as much as possible is surprisingly and disappointingly rare.
- csydas 2mo agomy experience as well. claude produces functional but over-engineered scripts fairly frequently with often very questionably useful safety checks, especially for powershell. a common tell of ai generated powershell is a script that has dedicated functions to check types, often via several methods, and happily prints the output of the checks to shell. i do not get why it does this but it often adds dozens of lines that really serve no purpose but to make the shell output look fancy
- genidoi 2mo agoIt's frustrating when I catch it doing this because it's wasting tokens and time on what it reports as "one-off" scripts. Might add a requirement to never use shell scripting unless the task is truly a one liner.
- garethrowlands 2mo ago$ Hey, claude, I've figured out the powershell one-liner we need and I've pasted it below. Please insert it into the application. ... I have analysed your idiomatic one-liner and propose adding the following 30 lines into the application Yes/Yes and always accept such idiocy/No ESCAPE ESCAPE /clear I want to update my powershell skill so that it writes idiomatic pipelines and does not introduce idioms from other languages. [PASTES overeagerness wording from Claude prompting best practices]
- cozzyd 2mo agoPython startup time is a problem. I don't know about ts but I bet it's worse.
- antonvs 2mo agoTS compiles to JS, so when you actually execute a script, you’re just starting Node, Deno, etc. with a JS file. Any of those are probably faster to start than Python. Deno in particular starts in around 15-60 milliseconds. Even if it has to compile the Typescript - which is a one-time operation if the script isn’t changing - it still typically starts in under 250ms.
- amelius 2mo ago> 50000 footguns (...) > especially in the age of LLMs Funny way of putting it. But I think you are right still :)
- wpm 2mo agoWhat other language is it as easy, fast, and painless to work with file contents? I can toss data down and lift it back up with some <> symbols and a path, none of Python's "errrm, how would you like to open that file " handholding. And why the hell would I want to go learn TypeScript!?!? Sometimes I feel like the people on HN repeating the trope "uhhh if you need ____ go learn a real language!" are just bad at writing shell scripts.