从OS X Dock执行Shell脚本? [英] Executing Shell Scripts from the OS X Dock?

查看:109
本文介绍了从OS X Dock执行Shell脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置要从Mac OSX扩展坞执行的Shell脚本?似乎简单地创建快捷方式将在我的编辑器中打开文件.我需要在某个地方设置一个标志来告诉它运行,而不是打开它进行编辑吗?

How do I set up a shell script to execute from the Mac OSX dock? It seems that simply creating a shortcut will open the file in my editor. Is there a flag I need to set somewhere to tell it to run instead of opening it for editing?

推荐答案

您可以通过一个步骤-运行Shell脚本"来创建Automator工作流

You could create a Automator workflow with a single step - "Run Shell Script"

然后单击File > Save As,然后将文件格式更改为应用程序".打开应用程序时,它将运行Shell脚本步骤,执行命令,并在完成后退出.

Then File > Save As, and change the File Format to "Application". When you open the application, it will run the Shell Script step, executing the command, exiting after it completes.

这样做的好处是真的简单易行,您可以非常容易地获得用户输入(例如,选择一堆文件),然后将其传递给shell脚本的输入(要么作为标准输入,要么作为参数).

The benefit to this is it's really simple to do, and you can very easily get user input (say, selecting a bunch of files), then pass it to the input of the shell script (either to stdin, or as arguments).

(Automator位于您的/Applications文件夹中!)

(Automator is in your /Applications folder!)

这篇关于从OS X Dock执行Shell脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆