2017-08-08 57 views
0

事实证明,在我的Mac上很好地哼唱的tool for evaluating json并不像我想的那样是跨平台的。一旦我安装了它在Ubuntu我得到这个错误:命令在GNU env中包含选项抛出错误

npm install -g pick_json 
echo '{ "foo" : { "bar" : 2 } }' | pick_json -e foo.bar 
/usr/bin/env: ‘node --harmony’: No such file or directory 

事实证明,GNU env认为与参数in the shebang line应该作为一个字符串来评估该命令。这在BSD上不会发生。在命令行上手动评估相同的命令似乎没有问题 - 错误只发生在文件中。

$ /usr/bin/env node --harmony 
> 

我曾尝试过各种无济于事,所以问题仍然存在:

如何传递的家当线将与GNU的env命令工作选项的命令?

回答

1

The #! syntax is generally called the Berkeley #! hack. It was a wonderful improvement over not having it at all. But is still considered a hack because it has many limitations. One is that only one argument is allowed. Some operating systems have a limit of not more than 32 characters for the line allowed.

相关问题