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

Leam Hall leamhall at gmail.com
Tue Apr 27 05:58:11 EDT 2021


On 4/26/21 10:11 PM, David Jackson via Ale wrote:
> Hey Everyone,
> 
> 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?
> 
> Also, how do you organize your scripts so they are easy for newcomers to 
> understand?
> 
> Your thoughts are appreciated!


Because of the growing number of shell options, and because I like 
Python/Perl/Ruby, I will usually only write shell/bash when it is a 
small system function (backups, etc) and I don't want the overhead of 
something bigger. Also, for things like installing packages and 
compiling a new language when my preferred language might not be on the 
machine.

I prefer not to break shell scripts into multiple files; if that is 
needed to organize it, then that's time to use something else. I saw one 
place that had a 50,000 line shell script/awk because they didn't want 
to use anything else.

-- 
Site Reliability Engineer  (reuel.net/resume)
Scribe: The Domici War     (domiciwar.net)
General Ne'er-do-well      (github.com/LeamHall)



More information about the Ale mailing list