Files
u-boot-krane/cmd
Rasmus VillemoesandTom Rini 04044a567b cmd: test: add support for =~ operator
Currently, the only way to make use of regex matching in the shell is
by using "setexpr [g]sub" command. That's rather awkward for asking
whether a string matches a regex. At the very least, it requires
providing setexpr with a dummy target variable, but also, the return
value of setexpr doesn't say whether any substitutions were done, so
one would have to do some roundabout thing like

  env set dummy "${string_to_test}"
  setexpr sub dummy '<some regex>' ''
  if test "${dummy}" != "${string_to_test}" ; then ...

When CONFIG_REGEX is set, teach the test command a new operator, =~,
which will allow one to more naturally write

  if test "${string_to_test}" =~ '<some regex>' ; then ...

The =~ operator with similar functionality is also supported in bash
when using its "extended" test operator [[ ]].

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2025-05-29 08:25:17 -06:00
..
2025-04-03 11:43:22 -06:00
2025-04-19 12:47:33 +02:00
2025-04-19 12:45:48 +02:00
2025-02-05 16:22:55 +01:00
2025-04-02 20:00:59 -06:00
2025-04-28 13:25:30 -06:00
2025-01-26 11:06:56 +01:00
2025-04-23 13:19:44 -06:00
2025-04-08 11:43:23 -06:00
2025-04-23 09:58:07 +02:00
2025-04-10 20:55:53 -06:00
2025-05-29 08:25:17 -06:00
2025-01-28 08:58:41 +02:00