[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ((...) && (...)) parsing confused by line break
From: |
Chet Ramey |
Subject: |
Re: ((...) && (...)) parsing confused by line break |
Date: |
Mon, 7 Feb 2005 08:53:21 -0500 |
> > This script fails:
> >
> > ( (echo line1) \
> > && (echo line2))
> > ((echo line3) && (echo line4))
> > ((echo line5) \
> > && (echo line6))
> >
> > like this:
> >
> > line1
> > line2
> > line3
> > line4
> > test.sh: line 5: syntax error near unexpected token `'
> > test.sh: line 5: `&& (echo line6))'
> >
> > It seems as though the problem line might be being treated as
> > though it is a ((...)) compound command, rather than nested
> > subshells.
>
> Of course it is. It's inherently ambiguous. Bash does its best,
> and is able to disambiguate in the case where everything appears on
> one line (since it's already been read and is available for analysis),
> but you can certainly fool it if you try hard enough.
I spoke too soon. I was able to make a small change that allows this to
work.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live...Laugh...Love
Chet Ramey, ITS, CWRU chet@po.cwru.edu http://tiswww.tis.cwru.edu/~chet/