3 ms·
The problem with shell scripts is the same as automation a gui. It’s flakey and hard to maintain. Grepping through output No uniform handling of spaces, tabs.
by jbverschoor 5y ago
The problem with shell scripts is the same as automation a gui.
It’s flakey and hard to maintain.
Grepping through output
No uniform handling of spaces, tabs. No data structures. Multiple dialects.
Shell scripts mainly work with files and process management. So many scripts don’t handle spaces correctly. This is not a problem of the creator, but because of the language.
- zelphirkalt 5y agoAlthough not following best practices when writing shell scripts is the fault of the author. For example not thinking about spaces and using $varname directly instead of adhering to best practice and enclosing it in "${...}". It is uninformed and one should inform oneself, if one is to write a shell script. Plus there is no shame in looking up, how to do it correctly. There is little excuse for getting that one wrong. I mean, if this is like one of the first shell scripsts one writes, OK, but a seasoned engineer ... nah.
- pm90 5y agoThere’s also automations like shellcheck that figure this out for you.
- jbverschoor 5y agoWell sure.. Then everybody, please stop blaming C, C++, php or wordpress. If it's the "wrong" way, remove it. Don't even deprecate it. Just hard throw an error. There are 10 tiny buttons next to each other. You press the wrong one. Was that your fault or the fault of the designer? Stop blaming "the user". In this case, not even a software engineer, but usually a sysop or power user.
- zelphirkalt 5y agoNo one (not that I have seen a comment like that anyway) is claiming, that shell scripts are not gnarly in some way or the other. However, this gnarliness of a language is of course a gradient, not an on-off, 1 or 0 kind of thing. Shell scripts are surely further on the gnarly end of things than some other things. If you ask me personally, I would not start a new project in any of the languages or frameworks you mentioned. I still do not agree though, that the user is completely not at fault, when there are easily avoided traps (if that is what you are proposing?). Of course those should ne even exist. I agree with that obviously. Blaming every single mistake on the language design, which might be gnarly, is not what I think is the correct thing to do though. We do not have the perfect language yet (or might never have it). So some gnarliness is to be expected and that means, that a realistic perspective is to educate oneself about those gnarly things and avoid mistakes. Mistakes are human, so there will be mistakes, but we should try to avoid cheap ones out of laziness or being uninformed. Also it is totally fine to criticize a language for its design flaws. I like to do that often even, with mainstream languages, because they can learn loads of stuff from less mainstream ones. This is the way to create awareness of those flaws and thus a way to improvement.