help-bash
[Top][All Lists]
Advanced

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

Re: Man page on conditional expressions: =~ missing?


From: Marco Ippolito
Subject: Re: Man page on conditional expressions: =~ missing?
Date: Thu, 27 Aug 2020 14:40:40 -0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.1.1

On 27/08/2020 11:02, Francois Tonneau wrote:
Hello,

I have a comment/suggestion/question about the man page of GNU bash
5.0.16(1) on Debian.

The section on:

Compound Commands
[[ expression ]], where expression is a conditional expression

mentions correctly that "an additional binary operator, =~, is available
..."

Yet later, in the section on:

CONDITIONAL EXPRESSIONS,
where "expressions are formed from the following unary or binary primaries"
..., I could not see any mention of =~ (whereas == and != are mentioned).

For the sake of completeness, shouldn't the =~ operator mentioned in the
later list?  A conditional expression with the regex operator does seem to
work in current bash (for example,  [[ foo =~ ^foo$ && bar == bar ]] &&
echo ok).

Man page:

> Conditional expressions are used by the [[ compound command and the test and [ builtin commands

Note:

One can't use =~ with [

If you do:

bash: [: =~: binary operator expected



reply via email to

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