Answer the question
In order to leave comments, you need to log in
Why is the ruby file.rb construct needed?
On the Internet and in books, they say that in order to call a ruby file from the command line, you need to write
ruby (filename).rb
Answer the question
In order to leave comments, you need to log in
Automatic detection of an interpreter, etc. this, of course, greatly simplifies life, but this is applicable only on the developer's machine, this method should not be used when deploying the application.
So if you develop locally, do whatever you want if you started writing bash scripts, ansible, chief, etc. then there you use the full construction with an explicit indication of the interpreter, otherwise the people to whom you provide the application will also have to configure the environment for you.
In general, this is syntactic sugar and, as always, it must be applied carefully and thoughtfully.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question