Shebang Node

2019 - 07 - 22

#!/usr/bin/env node

#! (pronounced shebang) tells the system what interpreter to pass that file to for execution. When a file has the above line is included, the system (*nix) will use Node.js to execute the file. This only works because Node makes a special exception for shebang characters. This will not work in a browser.

example file without .js extension

// hello
#!/usr/bin/env node

console.log('hello node env');
$ chmod +x ./hello
$ ./hello
$ hello node env
Previous Push Single Commit
Next How to delete a git tag