从Quicksilver运行终端命令

10

我知道有一个Quicksilver终端插件,但我想调用终端命令,这些命令基本上只在后台运行,从不弹出终端窗口。这可能吗?

更新:

我在我的AppleScript中有以下代码,但它给了我一个错误:

do shell script "/path/to/shell.sh blah" 

错误:

curses.setupterm()
_curses.error: setupterm: could not find terminfo database
3个回答

7
在 Quicksilver 中,您可以使用“在 Shell 中运行命令”这个动作,它是“终端模块”的一部分。该命令在不显示窗口的情况下运行。搜索引号中的术语,您会找到一些示例。

2

Applescript是一种简单的解决方案,详见:http://developer.apple.com/library/mac/#technotes/tn2002/tn2065.html

示例:

do shell script "ifconfig"
do shell script "ifconfig" user name "Anne" password "p@ssw0rd" with administrator privileges

Automator可以在后台运行shell脚本。

如果您熟悉XCode,可以使用Objective-C中的NSTask。


我有一个 shell 脚本,可以从终端运行并且正常工作,但是当我尝试使用 do shell script "/path/to/shell.sh blah" 运行相同的命令时,它会给出以下错误 curses.setupterm() _curses.error: setupterm: could not find terminfo database - user140736

1

等一下,你的shell脚本是bash shell脚本吗?在你的第一行中有:

#!/bin/bash

如果没有的话,请将该行添加到您的脚本中。 此外,不要只是


do shell script "/path/to/yourscript.sh"

考虑一下:

do shell script "/bin/bash /path/to/yourscript.sh"

这不是一个长时间运行的过程。我基本上有一个CLI待办事项脚本,我想使用Quicksilver快速添加我的待办事项。 - user140736
你能给我们提供更多有关todo脚本的信息吗? - chutsu
它所做的只是将项目添加到SQLite数据库中。因此,我执行类似于“todo -a blah”的命令,它会将blah添加到列表中。 - user140736

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接