I keep running into people that want to program their shell/perl scripts so that they source other scripts. Then those scripts call other scripts, and those scripts call other scripts.
At a recent client, we were trying to make sense of their database backup script. The main script called several other scripts, and those scripts called other scripts, and so on. It took hours of looking at way too many different scripts to figure out what was going on.
I understand reuse of code, but what's wrong with functions? At most I can see one giant script that contains common code that gets sourced by other backup scripts. Or MAYBE several scripts all in one directory that get sourced by other scripts. Multi-level sourcing, however, is just mean. 😉
Hey, I'm a consultant and I love the billable hours. Just trying to save you some time.
Can anyone tell me why this is a good idea?
----- Signature and Disclaimer -----
Written by W. Curtis Preston (@wcpreston). For those of you unfamiliar with my work, I've specialized in backup & recovery since 1993. I've written the O'Reilly books on backup and have worked with a number of native and commercial tools. I am now Chief Technical Evangelist at Druva, the leading provider of cloud-based data protection and data management tools for endpoints, infrastructure, and cloud applications. These posts reflect my own opinion and are not necessarily the opinion of my employer.