当我在linux机器上的time()
函数中包装任何脚本时,出现以下错误:
sh: 1: Syntax error: word unexpected (expecting ")")
> mkdir hello-world
> cd hello-world
> npm init
> vim package & update test script to `"test": "time(echo \"Error: no test specified\")"`
> npm test
{
"name": "hello-world",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "time(echo \"Error: no test specified\")"
},
"author": "",
"license": "ISC"
}
在终端上运行相同的命令会导致:
> time(echo \"Error: no test specified\")
"Error: no test specified"
real 0m0.000s
user 0m0.000s
sys 0m0.000s
"node": "~6.9.5",
"npm": "~3.10.10"