[ale] [EXTERNAL] Re: Bash Scripts: When to break them into files

Steve Litt slitt at troubleshooters.com
Tue Apr 27 18:08:27 EDT 2021

Allen Beddingfield via Ale said on Tue, 27 Apr 2021 15:42:22 +0000

>I think it depends on your mindset and expectation.  When I write a
>script, I assume I will never look at it again.  So, I sit down and
>hammer it out in one go with sparse/no comments, and no thought to
>readability.  If I have to revisit it after it is no longer fresh on
>my mind, I just start from scratch.  

Good enough, but if the line count starts exceeding 1000, do you really
want to rewrite every time some component used by the shellscript
changes its interface?

> I've got a collection of blobs of
>script that I reuse and will paste in (generating password, sed/awk
>stuff that I have found useful for repeated use, for example), 

That's a good thing, obviously.

> but for
>the most part, if I haven't looked at it recently, I just nuke and
>start over.  

If I had to start over on a shellscript, I'd darn well do it in Python,
Perl, Lua or Ruby, using the shellscript as a prototype.


Steve Litt 
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques

More information about the Ale mailing list