3 ms·
> "functionality of language X is broken in a 1-line program, but it works in a 83-lines program in language Y" Fair criticism. The difference though being tha
by thomashabets2 4y ago
> "functionality of language X is broken in a 1-line program, but it works in a 83-lines program in language Y"
Fair criticism. The difference though being that bash is implying a promise of being able to provide a solution in one line, but if you actually try to make bug free programs it'll end up being just as long as in Go. Without the readability, since you have to jump through crazy amounts of hoops since even the fixes/workarounds for the problems in bash don't have support in the language.
This makes bash's supposed strengths actually weaknesses, even for small programs.
> (pipes error handling are no doubt a rough area of Bash)
But that's my point when I condense this to calling bash useless. Pipes are maybe the core way that one ties together components in bash, and error handling is very important to not have bugs. Unhandled or mishandled errors are bugs.
> Asserting that only the 1-line case is the only valid use case for shell scripting
Well, I'd say that a 1-line case will not be correct, but will work in most day to day, if supervised.
And a correct shellscript can never be 1 line, and making it correct would make it 10s or 100s of lines of unreadable mess, that nobody would actually write or maintain.
Maybe there are wizards out there who write bug free bash. I've never met one. I've met many who think they are.
Most would probably be surprised that they'd have to write at least tens of lines of code to replace their use of the pipe operator, to have bug free code.