Daniel Upton
Daniel Upton

Reputation: 5741

Execute ruby script without .rb extension?

I know you can execute a script without typing "ruby" before the file name if you add a shebang, but how do you execute it without a file extension so instead of "filename.rb" you can use just "filename".

And, what's the norm/best-practice for deploying Ruby programs, i.e. file location and path etc.?

Upvotes: 2

Views: 1687

Answers (1)

Vlad
Vlad

Reputation: 35584

In linux, the information about the interpreter is usually taken from the shebang line, not from the extension. That's why you basically don't need the extension (but usually need the execute bit in the file attributes).

I don't know what are the traditions in Ruby about file naming (is it considered a good thing or not to include an extension), but it's generally a good idea to follow it (whatever it is).

Upvotes: 1

Related Questions