Bug#243885: \-quoting in character class
On Thu, Jun 03, 2004 at 03:48:55PM +0000, Gerrit Pape wrote:
>
> Hi, the upstream author of the diet libc disagrees, and quotes relevant
> parts from the susv3 standard, see
>
> http://article.gmane.org/gmane.linux.lib.dietlibc/541
> http://article.gmane.org/gmane.linux.lib.dietlibc/543
That's what I thought too if you read the entire BTS entry.
However, there is a special clause in section 2.13.1 which specifically
applies to bracket expressions.
: When pattern matching is used where shell quote removal is not performed
: (such as in the argument to the find -name primary when find is being
: called using one of the exec functions as defined in the System
: Interfaces volume of IEEE Std 1003.1-200x, or in the pattern argument
: to the fnmatch( ) function), special characters can be escaped to remove
: their special meaning by preceding them with a backslash character.
This is also how other shells (bash & pdksh) treat these patterns:
herbert@bree:~$ ksh -c 'case a in [\]a]) echo hi; ;; esac'
hi
herbert@bree:~$ bash -c 'case a in [\]a]) echo hi; ;; esac'
hi
herbert@bree:~$
Note: The case statement is another place where quote removal is not
performed.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Reply to: