简体   繁体   English

Mac OS X - 从桌面GUI运行shell脚本

[英]Mac OS X - run shell script from the desktop GUI

您可以创建一个shell脚本或Python或Ruby脚本,并使用“终端”在Mac上运行它...如果您打开Finder,并单击包含已保存shell脚本源代码的文件的图标有没有办法让脚本运行,而不是在我的文本编辑器中打开?

Yes - just put a .command suffix on the script. 是的 - 只需在脚本上添加.command后缀即可。

Note: make sure the script is executable, eg 注意:确保脚本是可执行的,例如

$ chmod +x myscript.command

Just another quick alternative is the tool platypus ( http://sveinbjorn.org/platypus/ ). 另一个快速替代方案是工具platypus( http://sveinbjorn.org/platypus/ )。 Free and good, but you can donate, if you want. 免费且好,但如果你愿意,你可以捐赠。

Platypus is a developer tool for the Mac OS X operating system. Platypus是Mac OS X操作系统的开发工具。 It creates native Mac OS X applications from interpreted scripts such as shell scripts or Perl, Ruby and Python programs. 它通过解释脚本(如shell脚本或Perl,Ruby和Python程序)创建本机Mac OS X应用程序。 This is done by wrapping the script in an application bundle along with a native executable binary that runs the script. 这是通过将脚本与运行脚本的本机可执行二进制文件一起包装在应用程序包中来完成的。

只需将.sh文件与Terminal.app关联即可

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM