Hello everyone, I just noticed that even though I call ruby form the
command line with a file as an argument it will execute the shebang
line.
Is this intentional behaviour? Because for me it doesn't hold to the
POLS.
I had a discussion with somebody about what should happen when you run
ruby with a file as an argument. We disagreed, so I didn't want to file
a bug right away, but hear some comments on the issue before. (I don't
know where to file bugs either.
$ ruby myrubyfile.rb
It will run ruby and it ignores the shebang line (it starts with a #, so
it's clearly an comment.)
This doesn't work though, so if my shebang line is the following:
"#!/usr/bin/perl", it will run perl.
The same if you use "#!/bin/rm /etc/fstab" as your shebang line.
If would basically run the shebang line.
Obviously if you run your script the following way: ./myrubyfile.rb
this is fine and intended. Because it has to check the shebang line
to see how it has to be interpreted / executed.
Python on the other hand does it right... If I run:
$ python myrubyfile.rb
it will ignore the shebang line and try to interpret it.
perl shows the same behaviour as ruby... This also got me thinking if I
may be completely off.
I used this analogy in the discussion I had:
$ openoffice finances.doc
shouldn't run finances.doc because it has a shebang line, it should try
to read it.
So reading for an "editing" tool and interpreting for an interpreter
is the same thing in my opinion.
I noticed all this when I was doing ruby -c randomfile.pl to make some
vim(:make) stuff. Random file completion.
...
In the end, who is right? Perl/Ruby or Python.
BR,
路路路
From my perspective it should work the following way:
--
Benjamin Andresen