Re: [DOC] Incomplete explanation about the regex =~ operator
From:
Greg Wooledge
Subject:
Re: [DOC] Incomplete explanation about the regex =~ operator
Date:
Thu, 17 Jan 2019 08:16:38 -0500
User-agent:
NeoMutt/20170113 (1.7.2)
On Thu, Jan 17, 2019 at 07:53:09AM +0100, kevin wrote:
> I looked at Greg Wooledge's site
> <https://mywiki.wooledge.org/BashGuide/TestsAndConditionals#Conditional_Blocks_.28if.2C_test_and_.5B.5B.29>:
>
>
> Since *[[* isn't a normal command (like [ is), but a /shell
> keyword/, *it has special magical powers*. *It parses its arguments
> before they are expanded by Bash and does the expansion itself*,
> taking the result as a single argument, even if that result contains
> whitespace. (In other words, [[ does not allow word-splitting of its
> arguments.) /However/, be aware that simple strings still have to be
> quoted properly. [[ treats a space outside of quotes as an argument
> separator, just like Bash normally would.
>
> Unfortunately, there is no example that shows how *[[* differs from the
> usual shell operation.https://mywiki.wooledge.org/BashFAQ/031 may be a better reference.