News for hackers. Stuff that matters.
Re:Scripting with Go by qbasic_forever on Friday March 11, 2022 @03:20PM (#30645494)
We 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.

Re:Scripting with Go by b215826 on Friday March 11, 2022 @05:52PM (#30647083)
> 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

[2] http://mywiki.wooledge.org/BashPitfalls

Re:Scripting with Go by jimbokun on Friday March 11, 2022 @10:52PM (#30648854)
I 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.
Re:Scripting with Go by tomcam on Saturday March 12, 2022 @02:49AM (#30649756)
That opened my mind… 30 years after I started using make. D’oh!
Re:Scripting with Go by jjtheblunt on Saturday March 12, 2022 @03:07PM (#30654438)
i do that too...folks seem surprised, but it's handy
Re:Scripting with Go by kaba0 on Saturday March 12, 2022 @05:57AM (#30650543)
Bash 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.
Re:Scripting with Go by GordonS on Saturday March 12, 2022 @09:42AM (#30651686)
> 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.