From 64d63f8fd06e5370694f760093c69cdc69652447 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 11 Aug 2021 01:34:55 +0000 Subject: Add case (yet untested) Signed-off-by: Laurent Bercot --- NEWS | 1 + doc/case.html | 93 ++++++++++++++++++++++++++++++++++ doc/index.html | 1 + doc/trap.html | 6 ++- package/deps.mak | 3 ++ package/modes | 13 ++--- package/targets.mak | 1 + src/execline/case.c | 123 +++++++++++++++++++++++++++++++++++++++++++++ src/execline/deps-exe/case | 2 + 9 files changed, 235 insertions(+), 8 deletions(-) create mode 100644 doc/case.html create mode 100644 src/execline/case.c create mode 100644 src/execline/deps-exe/case diff --git a/NEWS b/NEWS index 7941c37..c1f0a36 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ In 2.8.1.0 ---------- - Adaptation to skalibs-2.11.0.0. + - New binary: case. In 2.8.0.1 diff --git a/doc/case.html b/doc/case.html new file mode 100644 index 0000000..5340c07 --- /dev/null +++ b/doc/case.html @@ -0,0 +1,93 @@ + + + + + + execline: the case command + + + + + + +

+execline
+Software
+skarnet.org +

+ +

The case program

+ +

+case compares a value against a series of regular expressions, +and executes into a program depending on the first expression the value +matches. +

+ +

Interface

+ +

+ In an execlineb script: +

+ +
+     case [ -E | -e | -i | -n ] value
+     {
+       [ regex { prog... } ]
+       [ regex { prog... } ]
+       ...
+     }
+     progdefault...
+
+ + + +

Options

+ + + +

Subexpression matching

+ +

+ If the -N option has been given, and value matches a regex, +then case will run prog with a modified environment: +

+ + + +

+ To retrieve that information into your command line in an execline script, you can use the +elgetpositionals program. +

+ + + diff --git a/doc/index.html b/doc/index.html index 035e0eb..7dae446 100644 --- a/doc/index.html +++ b/doc/index.html @@ -167,6 +167,7 @@ to your installation: the shebang lines for your system might be something like