我错误地调用了 Sinatra Ruby 文件 app.py 并且它仍然有效,为什么?
我将一个 Ruby 文件命名为 app.py 并且它起作用了。我是后来才注意到的。为什么这可能。这并不复杂,只是一个小小的西纳特拉食谱,但我仍然不明白。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Unix(例如 Linux 或类似系统)下,脚本的第一行包含其解释器的路径。该行称为 Shebang 或 Crunchbang,看起来像这样:
如果重命名文件,解释器的路径仍然保持不变,因此脚本将像以前一样执行。
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:
If you rename you file, the path to the interpreter still remains unchanged and therefore the script will be executed as before.