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

Brian MacLeod nym.bnm at gmail.com
Wed Apr 28 14:41:50 EDT 2021

I will admit to being a bit of an outlier...

I am the current maintainer of a system configuration bash script that is
over 2000 lines long.  It has 20+ years of history at Georgia Tech (and
some other USG schools), and was refactored (locally) in the last 5-6 to
ONLY use shell commands, or simple and likely installed utilities on a
system (perl, awk, sed, ssh).  This script has been maintaining machines
from Solaris to current versions of RHEL and Ubuntu, and every now and
again, Mac OS.


I, like a couple of the original authors, are pretty good with shell
scripts, and shell is available on the systems we care about.  Twenty years
ago, there wasn't a lot available for systems management, particularly
across platforms.  Granted, I am the one who is also getting it to branch
out by detecting/installing newer management systems (SaltStack, Ansible),
as well as manage its continued development in Github. But it ultimately
all starts with shell for us.  And with that kind of history, well, it has
had a lot of debugging, so things just work.

And no, I have no plans to retire it or completely replace it with yet
another language or tool.  Augment it?  Absolutely.  That's actually one of
its best features, it makes that part easy.


On Mon, Apr 26, 2021 at 10:12 PM David Jackson via Ale <ale at ale.org> 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!
> Thanks!
> Dave
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> https://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.ale.org/pipermail/ale/attachments/20210428/5a9e3bad/attachment.htm>

More information about the Ale mailing list