























这是一个创建于 1810 天前的主题,其中的信息可能已经有所发展或是发生改变。
例子如下
$ set -x # enable debug output from bash
$ export PYTEST_FLAG='--pytest-args -k "not (xmllint or pclint)"';
$ pytest ${PYTEST_FLAG}
+ pytest --pytest-args -k '"not' '(xmllint' or 'pclint)"' # this line is the debug output
... error
从第四行可以看出,本来"not (xmllint or pclint)"应该作为一个字符串传递给pytest命令,但是 bash 在 variable expansion 后把"not, (xmllint 和 pclint)" 用单引号圈了起来,似乎因为他们含有一些特殊字符?如何阻止 bash 这种行为呢?谢谢
我最终想要 Bash 执行的命令为:
$ pytest --pytest-args -k "not (xmllint or pclint)"
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。