Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Nov 2002 06:44:47 +1000
From:      Greg Black <gjb@gbch.net>
To:        Wes Peters <wes@softweyr.com>
Cc:        Lyndon Nerenberg <lyndon@orthanc.ab.ca>, freebsd-hackers@freebsd.org
Subject:   Re: finding unmatched quotes in shell scripts 
Message-ID:  <nospam-1037738687.98439@bambi.gbch.net>
In-Reply-To: <3DDA8B7C.9BA63DC8@softweyr.com>  of Tue, 19 Nov 2002 11:05:32 PST
References:  <200211170159.gAH1xCG1052133@orthanc.ab.ca> <nospam-1037519839.91122@bambi.gbch.net> <3DDA8B7C.9BA63DC8@softweyr.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Wes Peters wrote:

| Greg Black wrote:
| > 
| > Lyndon Nerenberg wrote:
| > 
| > | I've tried a number of syntax-colouring editors, to no avail. The quotes
| > | (single, double, and back) *are* balanced, according to everything I've
| > | thrown the script at. That's why I'm more interested in something that
| > | can actually parse Bourne shell syntax (quiet Terry - I *know* what
| > | you're going to say) and dump out what it thinks the parse tree looks
| > | like. The problem isn't with the quotes being unbalanced, it's something
| > | else that's making the shell ignore one (or more) of those quotes.
| > 
| > Surely the simple thing is to put an exit statement in the
| > middle of the script and see which half has the problem?  Move
| > the exit statement forwards or backwards in a binary search
| > until the problem leaps out and hits you in the face.
| 
| Or simply set -x at the beginning of the script?

The only time I've ever faced a script where this sort of thing
was a problem, the output from -x was so voluminous (and so hard
to parse by eye), that it was much faster to work with the exit
statements as I outlined above.  A non-trivial script generates
an awful lot of output from -x and trivial scripts are easy to
debug.

Greg

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?nospam-1037738687.98439>