Some scripting languages (such as Python or Bash) use # for comments.
#!/usr/bin/env python
print 'hello, world'
I can run the script:
python script.py
Or
./script.py
Is it possible to make JavaScript support shebang?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can simply use
#!/usr/bin/env node(or whatever the name of your JavaScript interpreter is, it works fine withjs(spidermonkey), too).Most likely both interpreters test if the first line begins with
#!and in this case it is skipped.