From 45ca80e0e1509c613f05cdb5fe8ec1157a4a7a48 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 26 Nov 2021 07:00:11 +0000 Subject: Add shell matching option to case Signed-off-by: Laurent Bercot --- doc/case.html | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/case.html b/doc/case.html index a82eec8..8ae817b 100644 --- a/doc/case.html +++ b/doc/case.html @@ -31,7 +31,7 @@ matches.

-     case [ -E | -e ] [ -i ] [ -n | -N ] value
+     case [ -S | -s ] [ -E | -e ] [ -i ] [ -n | -N ] value
      {
        [ regex { prog... } ]
        [ regex { prog... } ]
@@ -57,6 +57,13 @@ is empty. 
 

Options

    +
  • -s : Shell matching. The regex words will not be +interpreted as regular expressions, but as shell expressions to be interpreted +via fnmatch(). +The other options also change meanings, see the Shell matching section below.
  • +
  • -S : Regular expression matching. This is the default. This +section, and all of the sections below except the Shell matching one, +assumes that it is the case.
  • -e : Interpret the regex words as basic regular expressions.
  • @@ -116,6 +123,41 @@ to the output of the /usr/bin/env command: 2=baz
+

Shell matching

+ +

+ If the -s option has been given to case, then the regex +words are not interpreted as regular expressions, but as shell patterns, as is +performed by the shell's +case +conditional construct. This has the following consequences: +

+ + +

Notes