Benjamin Kudria
5/11/2007 8:41:00 PM
On Friday, May 11 2007, Todd Burch wrote:
> So, when it comes down to it, what's the point of the shebang line?
I've always heard a slightly different, and in my opinion, logical
explanation.
Lets say you just got a new job as a sysadmin. The previous sysadmin was a
Perl guy, and since he was a good sysadmin, he used the shebang line in all
of his scripts , and he or she didn't add on the .pl .
Now, you come in, and seeing this Perl code, you scream and absolve to rewrite
it in Ruby, the cool kid on the block. After obtaining permission, you set
in and rewrite everything, and everything keeps working.
Now, imagine the same scenario, but no shebang line, and a .pl extension. If
you change the scripts, they won't work, because somewhere, someone is
running them with "perl myscript.pl", and myscript.pl will no longer exist,
or be a Perl script, after you are done with it.
So, shebang lines (and a lack of file extensions) are language-independent,
and future proof.
-Ben