Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 在Alpine 3.9上使用带有运行部件的正则表达式_Regex_Alpine - Fatal编程技术网

Regex 在Alpine 3.9上使用带有运行部件的正则表达式

Regex 在Alpine 3.9上使用带有运行部件的正则表达式,regex,alpine,Regex,Alpine,我正在从alpine:3.9.2创建一个Docker映像,我需要运行运行部件。我以前在ubuntu:16.04上使用过下面的脚本,没有出现问题 run-parts --verbose --regex '\.sh$' "$DIR" 然而,这一次,我在传递给它的选项上出现了错误。即 运行部件:无法识别的选项:详细 运行部件:无法识别的选项:正则表达式 据我所知,Alpine 3.9.2使用运行第4.8.6部分,该部分应来自Debinutils,并支持详细和正则表达式 我有什么

我正在从alpine:3.9.2创建一个Docker映像
,我需要运行
运行部件
。我以前在ubuntu:16.04上使用过下面的脚本,没有出现问题

 run-parts --verbose --regex '\.sh$' "$DIR"
然而,这一次,我在传递给它的选项上出现了错误。即

运行部件:无法识别的选项:详细

运行部件:无法识别的选项:正则表达式

据我所知,Alpine 3.9.2使用
运行第4.8.6部分
,该部分应来自
Debinutils
,并支持
详细
正则表达式

我有什么遗漏吗


如何在Alpine 3.9.2上运行以
.sh
结尾的所有文件?

默认情况下,Alpine image中的
运行部件的剪切版本非常多。这是一个忙碌的盒子:

/ # which run-parts
/bin/run-parts
/ # run-parts --help
BusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary.

Usage: run-parts [-a ARG]... [-u UMASK] [--reverse] [--test] [--exit-on-error] DIRECTORY

Run a bunch of scripts in DIRECTORY

    -a ARG      Pass ARG as argument to scripts
    -u UMASK    Set UMASK before running scripts
    --reverse   Reverse execution order
    --test      Dry run
    --exit-on-error Exit if a script exits with non-zero
它只能在目录中运行一堆脚本

如果要使用DebiNutils软件包中的uncut,需要先将其安装到alpine image:

/ # apk add --no-cache run-parts
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/1) Installing run-parts (4.8.6-r0)
Executing busybox-1.29.3-r10.trigger
OK: 6 MiB in 15 packages
现在,在alpine实例中有一个完整版本的
运行部件

/ # which run-parts
/usr/bin/run-parts
/ # run-parts --help
Usage: run-parts [OPTION]... DIRECTORY
      --test          print script names which would run, but don't run them.
      --list          print names of all valid files (can not be used with
                      --test)
  -v, --verbose       print script names before running them.
      --report        print script names if they produce output.
      --reverse       reverse execution order of scripts.
      --exit-on-error exit as soon as a script returns with a non-zero exit
                      code.
      --lsbsysinit    validate filenames based on LSB sysinit specs.
      --new-session   run each script in a separate process session
      --regex=PATTERN validate filenames based on POSIX ERE pattern PATTERN.
  -u, --umask=UMASK   sets umask to UMASK (octal), default is 022.
  -a, --arg=ARGUMENT  pass ARGUMENT to scripts, use once for each argument.
  -V, --version       output version information and exit.
  -h, --help          display this help and exit.

谢谢你的帮助。