10

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

更新:

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

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

错误:

curses.setupterm()
_curses.error: setupterm: could not find terminfo database
4

3 回答 3

7

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

于 2012-02-16T22:25:44.553 回答
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,则可以将 NSTask 与 Objective-C 一起使用。

于 2011-02-19T02:05:14.583 回答
1

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

#!/bin/bash

如果没有,请将该行添加到您的脚本中。也不仅仅是

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

考虑一下:

do shell script "/bin/bash /path/to/yourscript.sh"
于 2011-02-19T02:45:21.707 回答