What does “#!/bin/env” mean (at the top of a node.js script)?

后端 未结 2 1551
难免孤独
难免孤独 2021-01-31 02:05

I found serval node.js projects that have this at top of their app.js (as in this openshift program):

#!/bin/env node

What does th

相关标签:
2条回答
  • 2021-01-31 02:36

    The full line from your example is:

    #!/bin/env node
    

    This simply means that the script should be executed with the first executable named 'node' that's found in your current PATH.

    The shebang (#!) at the start means execute the script with what follows. /bin/env is a standard unix program that looks at your current environment. Any argument to it not in a 'name=value' format is a command to execute. See your env manpage for further details.

    0 讨论(0)
  • 2021-01-31 02:38

    env is a shell command used to specify an interpreter.

    0 讨论(0)
提交回复
热议问题