From owner-freebsd-hackers Tue Nov 19 12:44:59 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B10F537B401 for ; Tue, 19 Nov 2002 12:44:57 -0800 (PST) Received: from gw.gbch.net (gw.gbch.net [203.143.238.93]) by mx1.FreeBSD.org (Postfix) with SMTP id 37E2143E75 for ; Tue, 19 Nov 2002 12:44:55 -0800 (PST) (envelope-from gjb@gbch.net) Received: (qmail 98477 invoked by uid 1001); 20 Nov 2002 06:44:47 +1000 X-Posted-By: GJB-Post 2.29 08-Nov-2002 X-Operating-System: FreeBSD 4.2-RELEASE i386 X-Uptime: 139 days, 12:42 X-Location: Brisbane, Australia; 27.49841S 152.98439E X-URL: http://www.gbch.net/gjb.html X-Image-URL: http://www.gbch.net/gjb/gjb-auug048.gif X-GPG-Fingerprint: EBB2 2A92 A79D 1533 AC00 3C46 5D83 B6FB 4B04 B7D6 X-PGP-Public-Keys: http://www.gbch.net/keys.html Message-Id: Date: Wed, 20 Nov 2002 06:44:47 +1000 From: Greg Black To: Wes Peters Cc: Lyndon Nerenberg , freebsd-hackers@freebsd.org Subject: Re: finding unmatched quotes in shell scripts References: <200211170159.gAH1xCG1052133@orthanc.ab.ca> <3DDA8B7C.9BA63DC8@softweyr.com> In-reply-to: <3DDA8B7C.9BA63DC8@softweyr.com> of Tue, 19 Nov 2002 11:05:32 PST Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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