2017-08-08 79 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.

相關問題