我错误地调用了 Sinatra Ruby 文件 app.py 并且它仍然有效,为什么?

发布于 2025-01-05 02:44:09 字数 83 浏览 2 评论 0原文

我将一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

隐诗 2025-01-12 02:44:09

在 Unix(例如 Linux 或类似系统)下,脚本的第一行包含其解释器的路径。该行称为 Shebang 或 Crunchbang,看起来像这样:

#! /usr/bin/ruby

如果重命名文件,解释器的路径仍然保持不变,因此脚本将像以前一样执行。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文