|
From: | kevin |
Subject: | Fwd: Re: [DOC] Incomplete explanation about the regex =~ operator |
Date: | Sat, 12 Jan 2019 10:39:28 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
Le 09/01/2019 à 21:37, Chet Ramey a écrit :
On 1/9/19 2:27 PM, kevin wrote:My message was poorly formatted (I lack of experience) and consequently you misunderstood it. The shell operation is unusual when a regular expression appears inside a conditional expression. Indeed, neither the Bash man page or the Bash Reference Manual indicates that the shell quotes some characters internally (Bash FAQ:http://git.savannah.gnu.org/cgit/bash.git/tree/doc/FAQ#n1927)."Any part of the pat- tern may be quoted to force the quoted portion to be matched as a string."Moreover, the explanation in the Bash FAQ is unclear; it lacks examples to know when "an interference" occurred.What is "an interference"?Look at the following answer to get an overview of the issue: https://stackoverflow.com/a/12696899That answer is correct: bash uses the C library's regexp library and only guarantees that POSIX EREs work.
I do not speak English very well.The Bash FAQ indicates that the shell works differently in a conditional expression formed usinga regular expression. Nonetheless, the Bash FAQ does not give examples to get a concrete idea.
|"In versions of bash prior to bash-3.2, the effect of quoting the regular expression argument to the [[ command's =~ operator was not specified. *The practical effect* was that double-quoting the pattern argument required backslashes to quote special pattern characters, *which interfered with* the backslash processing performed by double-quoted word expansion and was inconsistent with how the == shell pattern matching operator treated quoted characters."|
I do not see the practical effect because I do not find concrete cases (or examples). In other words, I do not understand the justification.
Finally, the fact that the shell works differently in the mentioned case should be indicated in the man page and Texinfo source.
[Prev in Thread] | Current Thread | [Next in Thread] |