What does "#! / Bin / env" mean (at the top of the node.js script)?

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

 #!/bin/env node 

What does it mean? How it works? Where is this useful?

+54
declare openshift
Feb 25 '13 at 6:01
source share
2 answers

Full line from your example:

 #!/bin/env node 

It just means that the script must be executed with the first executable file named "node", which is found in your current PATH.

Shebang (#!) At the beginning means executing the script as follows. / bin / env is the standard unix program that looks at your current environment. Any argument for it not in the format "name = value" is a command to execute. See the env man page for more information.

+66
Feb 25 '13 at 6:11
source share

env is a shell command used to specify an interpreter.

+8
Feb 25 '13 at 6:06
source share



All Articles