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

DJ-Pfulio DJPfulio at jdpfu.com
Tue Apr 27 10:38:06 EDT 2021


On 4/26/21 10:11 PM, David Jackson via Ale wrote:
> 
> When do you guys feel that your bash scripts have gotten too long?
> When do they need to be broken out into individual files, and when
> does doing so make them less easy to maintain or follow?

Any bash script over 1 page needs to be written in an easier to read language.

Any function/method over 1 page needs to be split up into multiple functions. Since my bash scripts aren't usually allowed to be more than 1 page, that means some other language is used.

Even a script that is just doing error checking for 1 real command can be 60 lines long. I have a few like that. I ignore the 1-page rule, as long as the functionality fits into 1-page.  Header comments, variable setup can be multiple pages.


More information about the Ale mailing list