On Fri, 2009-01-02 at 10:50 -0500, James Vega wrote:
> On Wed, Dec 31, 2008 at 07:42:07PM +0000, Adam D. Barratt wrote:
> > Modifying the comment removal to not treat "$#" as the start of a
> > comment fixes this particular instance, but I'm not sure whether there
> > are any other cases where it'll break.
> 
> Comments need to either start at the beginning of the line

Those we already handle.

> or have whitespace before the #.

It's slightly more involved than just whitespace, afaics from reading
bash(1) and a little experimentation - the comment must begin a word,
which means that we also need to consider &, ;, "(" and ")" (none of the
set "<>|{}" appears to be sufficient to begin a comment and so can be
ignored).

> That should be an easy enough check to add.

Indeed; thanks for the pointer.

We've already got a check ensuring that the # isn't escaped, which is
where I was planning on adding the check for $; I'll turn that in to a
positive assertion matching only the allowed characters.

Adam




-- 
To unsubscribe, send mail to [email protected].

Reply via email to