I guess my question is pretty hard to decipher (feel free to perfect it). But it pertains to the use of shebang lines in scripts – specifically, in this case, JavaScripts. Let's say I have this phantomjs
script:
#!/usr/bin/env phantomjs
/*
Requires phantomjs to be installed (e.g. via Homebrew on Mac)
Example URL:
http://code.google.com/p/phantomjs/wiki/QuickStart#DOM_Manipulation
*/
var page = require('webpage').create(),
url = 'http://lite.yelp.com/search?find_desc=pizza&find_loc=94040&find_submit=Search';
page.open(url, function (status) {
if (status !== 'success') {
console.log('Unable to access network');
} else {
var results = page.evaluate(function() {
var list = document.querySelectorAll('span.address'), pizza = [], i;
for (i = 0; i < list.length; i++) {
pizza.push(list[i].innerText);
}
return pizza;
});
console.log(results.join('\n'));
}
phantom.exit();
});
I suspect this is a highly ridiculous question, but:
Is there any possible trick that lets you keep a shebang line such as in the code above – so that you can execute the file without the need to prefix the script execution with (in this case) phantomjs
– and still have it interpreted without errors in JavaScript?
If not, is there any other language interpreter (e.g. Ruby, Python) that 'accepts' shebang lines, or better yet, has a way to ignore them?