Take the 2-minute tour ×

I have several (bash) scripts that are run both individually and in sequence. Let's call them one, two, and three. They take awhile to run, so since we frequently run them in order, I'm writing a wrapper script to simply call them in order.

I'm not running into any problems, per se, but I'm realizing how brittle this is. For example:

script two has a -e argument for the user to specify an email address to send errors to. script three has a -t argument for the same thing. script one's -e argument means something else

My wrapper script basically parses the union of all the arguments of the three subscripts, and "does the right thing." (i.e. it has its own args - say -e for email, and it passes its value to the -e arg to the second script but to the -t arg for the third).

My problem is that these scripts are now so tightly coupled - for example, someone comes along, looks at scripts two and three, and says "oh, we should use the same argument for email address", and changes the -t to a -e in script three. Script three works fine on its own but now the wrapper script is broken.

What would you do in this situation? I have some big warnings in the comments in each script, but this bothers me. The only other thing I can think of is to have one huge monolithic script, which I'm obviously not crazy about either.

share|improve this question
This sounds enterprise-y, but what source and change control processes are in place? My short answer is: train the maintainers to edit the wrapper too. –  glenn jackman Sep 26 '11 at 19:09
add comment

1 Answer

up vote 0 down vote accepted

The problem seems to be that people are thoughtlessly changing the API of the underlying scripts. You can’t go around arbitrarily changing an API that you know others are depending on. After all, it might not just be this wrapper script that expects script #3 to take a -t argument. So the answer seems to be: stop changing the underlying scripts.

share|improve this answer
add comment

Your Answer


