[Top][All Lists]

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

Re: Inconsistence when checking if a pattern is quoted or not for `==' a

From: Greg Wooledge
Subject: Re: Inconsistence when checking if a pattern is quoted or not for `==' and `=~' in [[ ]]
Date: Thu, 17 Feb 2011 10:28:54 -0500
User-agent: Mutt/

On Thu, Feb 17, 2011 at 05:07:40PM +0200, Pierre Gaston wrote:
> On Thu, Feb 17, 2011 at 4:56 PM, Clark J. Wang <address@hidden> wrote:
> > The point is: ``Any part of the pattern may be quoted to force  it  to  be
> > matched  as  a string.'' And backslash is one of bash's quoting chars.

> aaah well the "it" in "force it" is the part, not the whole pattern. so if
> you do \.. the first . is a litteral dot, the second one matches any char.

I think you're all missing what Clark's question actually is.  Consider

imadev:~$ cat <<\EOF
> EOF 

The use of a backslash in front of one of the characters of the
here-document's sentinel word is considered "quoting".  And because the
sentinel word is "quoted", parameter expansions in the body are not done.

Clark is asking why the use of a backslash before a character on the
right-hand-side of =~ is not considered "quoting" the same way it is when
doing it to a here-document's sentinel word.

My own answer to that is "Who cares, stuff it all in a variable and don't
worry about it," but I suppose it's important that someone cares. ;-)

reply via email to

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