Hello,

I thought the dash shell is strictly conforming to the POSIX shell standard.  
But it seems, I see a discrepancy.  It probably means, I don't understand the 
standard.  Please explain what is going on.


The standard says in the section 2.2.3 on Double-Quotes and $ : "even number of 
unescaped double-quotes or single-quotes, if any, shall occur".

"Shall" means that if that is not followed, an error will result.  

There is an approved change to this paragraph, not published yet:

http://austingroupbugs.net/view.php?id=221

which says, instead:

For the four varieties of parameter expansion that provide for 
substring processing (see [xref to 2.6.2 Parameter Expansion]), 
within the string of characters from an enclosed "${" to the 
matching '}', the double-quotes within which the expansion occurs 
shall have no effect on the handling of any special characters.



"Shall" means that if that is not followed, an error will result.

But the dash shell does this:

$ FOOBAR="'" ; echo "${FOOBAR#'}" 

$



According to the published standard, this should be an error because there is 
non-even number of ' inside {}

According to the approved change, there should be no effect of the enclosing "" 
on the handling of inside ' , which also does not seem to be the case:

$ FOOBAR="'" ; echo ${FOOBAR#'} 
> 



I am using the dash from 2011, and the change was approved in Sep 2010.


Thank you for explanation,

Mark

Reply via email to