在 OSX 和 Windows 上从 Ruby 运行任意系统命令

发布于 2024-07-26 23:18:35 字数 446 浏览 4 评论 0原文

我想从 ruby​​ 脚本打开 OSX 窗口(和 Windows 窗口)。 如果我

system "touch /Users/apple/Documents/thekbase-temp-files/test5.txt"

这样做,它会起作用(创建一个空文件),但这

system "mate /Users/apple/Documents/thekbase-temp-files/test5.txt"

不会打开 TextMate,即使我键入它会打开 TextMate。 我觉得这可能是这个问题的版本,但我只想为了确定。

谢谢!

I would like to open OSX windows (and Windows windows) from a ruby script. If I do

system "touch /Users/apple/Documents/thekbase-temp-files/test5.txt"

it works (creates an empty file), but this

system "mate /Users/apple/Documents/thekbase-temp-files/test5.txt"

does not open TextMate, even though it does if I type it. I feel this might be a version of this question but I just want to be sure.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

囍孤女 2024-08-02 23:18:35

尝试

system "open -a textmate /Users/apple/Documents/thekbase-temp-files/test5.txt"

Try

system "open -a textmate /Users/apple/Documents/thekbase-temp-files/test5.txt"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文