user866503
user866503

Reputation:

By mistake, I called a Sinatra Ruby file app.py and it still worked, why?

I named a Ruby file app.py and it worked. I only noticed later. Why is that possible. It wasn't anything complicated, just a small Sinatra recipe but still, I don't understand.

Upvotes: 0

Views: 74

Answers (1)

user1099383
user1099383

Reputation:

Under Unix (say, Linux or similar), the first line of a script contains the path to its interpreter. The line's called Shebang or Crunchbang and looks like that:

#! /usr/bin/ruby

If you rename you file, the path to the interpreter still remains unchanged and therefore the script will be executed as before.

Upvotes: 1

Related Questions