2017-08-08 6 views
0

私のMac上でうまく動いているtool for evaluating jsonは、私が思ったようにクロスプラットフォームではないことが判明しました。私はUbuntuの上でそれをインストールしたら、私はこのエラーを得た:GNU env shebang行のオプションでコマンドを実行するとエラーが発生する

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 envin the shebang lineが1つの文字列として評価されるべき引数を指定してコマンドを考えていることが判明しました。これは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.

関連する問題