3 ms·
I agree in principle, but mastering the syntactic quirk-fest of bash and other shells is really a bit weird, in that surprises arise at runtime. maybe that's t
by jjtheblunt 5y ago
I agree in principle, but mastering the syntactic quirk-fest of bash and other shells is really a bit weird, in that surprises arise at runtime.
maybe that's the compelling use of scripting with a statically typed, thus compile-time at least partially low-hanging-fruit-error-checked, language?
- qbasic_forever 5y agoWe really need a 'Bash: The Good Parts' book like Doug Crockford did for Javascript. IMHO bash and the shell are in a state that Javascript was ~2005--an old language/tool full of complexities but that can be sharpened and honed down to something beautiful. IMHO writing procedural style code with lots of if, loops, etc. in the shell can quickly turn into an anti-pattern. Try to stick to simple functions that are chained together in pipelines. The only loop is typically one that processes arguments and that's it.
- b215826 5y ago> We really need a 'Bash: The Good Parts' book like Doug Crockford did for Javascript. Bash is incredibly less complex than Javascript and there is such a resource: the "Bash guide" [1] and "Bash pitfalls" [2] are both excellent resources that teach you how to use Bash properly. [1] http://mywiki.wooledge.org/BashGuide http://mywiki.wooledge.org/BashGuide [2] http://mywiki.wooledge.org/BashPitfalls http://mywiki.wooledge.org/BashPitfalls
- jimbokun 5y agoI have a coworker who uses make for tasks that do not fit comfortably in a few lines of shell script, and it can make for very elegant and readable solutions. Without giving in to the procedural constructs that are so awkward in shell scripting languages.
- tomcam 5y agoThat opened my mind… 30 years after I started using make. D’oh!
- jjtheblunt 5y agoi do that too...folks seem surprised, but it's handy
- kaba0 5y agoBash really just should die already. I really don’t see it being more available than python is, and the fact that basically every 3+ line bash script is logically faulty should be enough of a reason. Add that they are basically unreadable after writing.
- GordonS 5y ago> I really don’t see it being more available than python is Oh, but which version, 2 or 3? Bash availability may not be guaranteed, but a POSIX shell of some variety is.
- throwaway984393 5y agoPeople talk about Bash quirks as if Python and Go don't have plenty of quirks that you also find out by trial and error. The difference is, most people hardly ever use Bash. If it were the reverse and people hardly ever used Python or Go or JavaScript, they'd be talking about how quirky those languages are. (They already do, in relation to other languages) Shellcheck has dramatically increased the ease by which you can write decent scripts before ever running them. But I also have never seen any language that anyone could master without a year or more of constant use.