And that's the problem with bash scipting - very quickly it gets very cryptic, difficult to follow and understand without knowing various "clever tricks" and gimmicks.
This is all fine and dandy for personal usage but god forbid other developers might need to changes something inside this kind "clever" code.