bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: quoting inside backquotes in 3.1


From: Chet Ramey
Subject: Re: quoting inside backquotes in 3.1
Date: Sun, 05 Mar 2006 16:44:37 -0500
User-agent: Thunderbird 1.5 (Macintosh/20051201)

Oliver Kiddle wrote:
> Is it intentional that the following script, which worked in 2.05b now
> produces errors in 3.1:
> 
> : `: "\\""`
> 
> That now results in: unexpected EOF while looking for matching ``'
> Using a third backslash fixes it but this is inconsistent with ash bash2
> bsh ksh pdksh and zsh.

This is how I interpreted POSIX's requirement that quoted strings
inside backquotes be recursively processed:

"While processing the characters, if instances of expansions or quoting
are found nested within the substitution, the shell shall recursively
process them in the manner specified for the construct that is found."

The double-quoted string is processed, the backslash quotes the
succeeding backslash, the second double quote terminates the quoted
string, and we are left with a syntax error.

This POSIX requirement may be new -- I didn't analyze previous shell
implementations -- but its intent seems to be to allow embedded quoted
strings to contain backquotes (for instance).

I will see if I can find a way to preserve backwards compatibility.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                           Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]