0

It turns out that a tool for evaluating json that has been humming along nicely on my Mac wasn't as cross platform as I thought. Once I installed it on Ubuntu I got this error:

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

It turns out that GNU env thinks the command with the argument in the shebang line should be evaluated as one string. This does not happen on BSD. Manually evaluating the same command on the command line seems to be fine - the error only happens when it is written in the file.

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

I have tried various to no avail, so the question remains:

How can I pass options to the command in the shebang line that will work with GNU's env command?

oligofren
  • 20,744
  • 16
  • 93
  • 180

1 Answers1

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.

tso
  • 4,732
  • 2
  • 22
  • 32