[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: |
Fri, 04 Feb 2005 17:22:03 -0500 |
User-agent: |
Mozilla Thunderbird 1.0 (Macintosh/20041206) |
Tim Waugh wrote:
Machine Type: i386-redhat-linux-gnu
Bash Version: 3.0
Patch Level: 16
Release Status: release
Description:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=146638
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.
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://cnswww.cns.cwru.edu/~chet/
- Re: ((...) && (...)) parsing confused by line break,
Chet Ramey <=