Hacker News new | ask | show | jobs
by Huffers2 1942 days ago
Agreed entirely. I inherited a system with 50k lines of unreliable shell scripts. I figured out ways to unit test them, do mocking, and pushed developers to unit test their scripts. I even wrote long articles of best practices for writing reliable scripts, including massive lists of gotchas.

Eventually I realised it was a lost cause and really you just shouldn't use shell scripts for anything that you want to be reliable above a trivial level of complexity.

That was with PowerShell, but I wouldn't be surprised if the same applies to bash as well.

2 comments

That is what you get when you let anybody write scripts without code review.

Bash people are the worst when they switch, since they keep the same mentality and continue parsing strings or use other bashizms.

See my answer above also.

With Powershell it is possible to write decent code imho.

Powershell is on another plane, more like Python and less like bash shell scripting.

I used Powershell and Pester a lot and it worked great.

Bash becomes a mess of cat grep sed awk cut