Javascript 是否使用package.json脚本在同一目录中复制多个文件?

Javascript 是否使用package.json脚本在同一目录中复制多个文件?,javascript,node.js,shell,package.json,cp,Javascript,Node.js,Shell,Package.json,Cp,这在命令行上起作用: cp target/{sitemap.xml,robots.txt} ../fs-dtest-app/ 但是如果我将命令放在package.json中的脚本标记中,如下所示: "scripts": { "c": "cp target/{sitemap.xml,robots.txt} ../fs-dtest-app/" }, 发生这种情况: ole@mkt:~/Temp/dtest/fs-dtes

这在命令行上起作用:

cp target/{sitemap.xml,robots.txt} ../fs-dtest-app/
但是如果我将命令放在
package.json
中的脚本标记中,如下所示:

  "scripts": {
    "c": "cp target/{sitemap.xml,robots.txt} ../fs-dtest-app/"
  },
发生这种情况:

ole@mkt:~/Temp/dtest/fs-dtest-md$ cp target/{sitemap.xml,robots.txt} ../fs-dtest-app/
ole@mkt:~/Temp/dtest/fs-dtest-md$ npm run c

> @fireflysemantics/fs-dtest-md@1.0.1 c /home/ole/Temp/dtest/fs-dtest-md
> cp target/{sitemap.xml,robots.txt} ../fs-dtest-app/

cp: cannot stat 'target/{sitemap.xml,robots.txt}': No such file or directory
想法?

将使用
/bin/sh
,而不是用户当前的交互式shell,不管是什么(或MS平台上的
cmd.exe

在交互式zsh shell中:

% echo $0
zsh
从同一个交互式shell运行
npm

% npm run shell

> so65660483-npm-shell@1.0.0 shell /so/so65660483-npm-shell
> echo $0

sh
支持在任何情况下复制多个文件而不依赖shell全局复制:

cp target/sitemap.xml target/robots.txt ../fs-dtest-app/