可能会收到 一 可选参数 然后跑。
代码如下所示:
docker-compose exec foo ./manage.py test integration_tests.tests$@ --noinput
如果指定了参数,则路径应为 integration_tests.tests.path.to.module .如果不是 integration_tests.tests
integration_tests.tests.path.to.module
integration_tests.tests
注意后面的点 tests .
tests
如何修改 integration_tests.tests$@ 要妥善处理这件事?Smth-like integration_tests.tests${@:-.@}
integration_tests.tests$@
integration_tests.tests${@:-.@}
你想要 ${1:+.} 这个 + 这意味着,如果设置了变量,请使用此文本,否则不使用任何内容。
${1:+.}
+
docker-compose exec foo ./manage.py test "integration_tests.tests${1:+.}$1" --noinput
使现代化 :错失报价以防万一 $1 有空格之类的。
$1