News for hackers. Stuff that matters.
Re:Advanced Bash-Scripting Guide (2014) by metadat on Friday August 19, 2022 @02:12PM (#32524352)
100% sane advice on the "should" front, but I don't always follow the shoulds..

Bash is just too damn fast to whip things up in (even at the risk of endless footguns). Build up a pipeline of commands, translate into script, done. It's powerful and can scale if common conventions and good practices are used.

For easier debugging I always add a simple flag along the lines of: if $1 = -v then set -x; shift

Obviously shellscripts are a terrible or highly suspect idea when production-grade transactional integrity is critical, but in many cases the swiftness of shell development outweighs the cons when the goal is to Get Things Done.

The shell is a pretty sweet interface.

Re:Advanced Bash-Scripting Guide (2014) by cjvirtucio on Friday August 19, 2022 @02:34PM (#32524544)
it's so much easier to glue tools together with it. I'd end up writing more code if I had used python's subprocess package or ruby's IO package. as long as I don't need a complex data structure of some sort.