如何使用GNU并行在所有具有包装函数的*.sh上运行外壳检查?
此尝试具有正确的目标文件,但Parallel似乎难以使用子subshell。
lint:sh() {
local output
targets=$(find . -name '*.sh' -exec echo {} \;)
output=$(parallel --no-notice shellcheck ::: "$targets")
results $? "$output"
}发布于 2018-06-26 17:07:42
使用以下方法:
lint:sh() {
local output
output=$(find . -name "*.sh" -print0 | parallel -q0 --no-notice shellcheck)
...
}发布于 2018-06-26 15:43:24
由于bash的不同缺陷,最安全的方法可能是
targets=()
while read -r -d '' file; [[ $file ]]; do
targets+=("$file");
done < <(find . -name '*.sh' -print0)还因为targets类型已更改为数组
output=$(parallel --no-notice shellcheck ::: "${targets[@]}")https://stackoverflow.com/questions/51035770
复制相似问题