imaginary family values presents

yesh omrim

a blog that reclines to the left

Logo

A debugging tip for weak-minded programmers (like me)

19 June 2009

So if you have some script1 that was created with the time-honored “copy, paste, edit” method of abstraction, and it’s not doing what you expect, and you’re just tearing your hair out because the part that you edited is perfectly clear and works just fine when you try it from the command line all by itself, and you’re not really sure what one of the parts that you copied and pasted is doing but since all these other scripts use the same code surely there’s nothing wrong with it… you may want to consider the possibility that there’s some relationship between the code that you don’t understand and the output that you don’t expect.

There’s some cutting-edge engineering wisdom that I acquired through bitter and embarrassing experience. I’ll probably reacquire it next week.

1 If a one-liner2 in a Makefile can be dignified with the term “script”.

2 If five lines of shell code joined with backslashes can be dignified with the term “one-liner”.