我package.json
具有这样它的脚本:指定其外壳采用的纱线运行脚本
"buildTslint": "node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts",
注意{,helpers/}*.ts
的一部分,这就是所谓的Brace Expansion且只能在bash
,不sh
。
当运行yarn buildTslint
我得到以下输出:
# yarn buildTslint
yarn buildTslint v0.22.0
$ node_modules/typescript/bin/tsc node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts
error TS6053: File 'node_modules/awesomeLibrary_node_tslint/{,helpers/}*.ts' not found.
error Command failed with exit code 2.
看来,纱线使用sh
执行这些脚本,但我想用bash
关于这个问题,可以使用大括号展开。
'的bash -c '命令..''按预期工作,非常感谢。但是,有没有设置默认shell的方法,所以在将来不会发生? –
我认为不是如果它是通过纱线系统调用完成的,它是特定于实现的,并且由于'man 3 exec'' man 3 system'指定了'/ bin/sh' –