Re: [hatari-devel] Shell scripts (off-topic)

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On torstai 21 helmikuu 2013, Douglas Little wrote:
> Yes awk, sed etc are compact, efficient - but it can be close to
> impossible read anyone else's code.

For starters one needs to be fluent with regexps as they're all
about text parsing.

(Different tools have slightly different regexp syntax, especially
about escaping special characters, which makes it a bit more challenging.
These differences are explained in some O'Reilly regexp book I think.)


> There's a chunk of such stuff in one of our projects and most of our
> engineers refuse to touch it because it looks like compressed file
> displayed as ASCII (or an entry to one of those obfuscated coding
> competitions). Worse still, it's in a key part of our makefile skeleton
> and the guy who wrote it left. :-)

I guess you already know this, but the key in debugging them is not trying
to understand it as whole, but debugging things in the pipeline one element
at the time.

Removing everything else until one groks how given filter modifies
the text stream, before adding next piece of the pipeline for
investigation.

Admittedly some can indeed be completely incomprehensible, especially
when they use a lot of esoteric commands and don't document what the stages
in the pipeline are even supposed to do.  There are some good examples e.g.
in stackoverflow.com. :-)


	- Eero



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/