2

试图检索我的 shell 命令的输出,所以我将它分配给一个变量并尝试通过 LogSuccess 命令记录它。

put shell ("cat login.txt") into myOutput
LogSuccess myOutput

不幸的是,我在日志中看不到任何内容,或者无论如何都不知道该命令实际上已发送到 shell。有人知道我错过了什么吗?

4

1 回答 1

2

当前的 eggPlant API 不返回shell()命令的输出。一个不错的解决方案是将命令的输出重定向到文件,然后立即读取。

set destinationFile to "~/tempfile"
shell "cat login.txt > " & tempFile

LogSuccess file destinationFile

上面的代码示例将向您显示命令的输出。

于 2014-08-05T20:17:06.913 回答