gpt4 book ai didi

bash - 如何在单独的自动变量中获得这些结果?

转载 作者:行者123 更新时间:2023-11-29 09:28:04 24 4
gpt4 key购买 nike

我制作了一个运行 bash shell 脚本并获得两个输出的小型自动化脚本...在查看结果时,它如下所示...

Multiple Results

我希望它们在两个自动变量中假设我使用了一个像

这样的脚本
echo "200"
echo "19 hours, 4 minutes and 42.765 seconds"

并在查看结果时显示了这一点(我希望其中的每一个都作为自动化变量,称为 countduration/强>)。我希望将其发送到显示通知,副标题为“count files processed”,消息为“duration 过去了”。我怎样才能做到这一点?

最佳答案

您可以通过 applescript 修改 Automator 变量。 变量必须存在于工作流中,因此您首先应该添加两个变量,以获得如下图所示的内容:

enter image description here

你可以设置任意值作为它们的初始值...

在上面之后,你可以使用下一个 applescript,就在你的 shell 脚本之后

on run {input, parameters}
set value of variable "Count" of front workflow to item 1 of input
set value of variable "Duration" of front workflow to item 2 of input
return input
end run

它不完全正确,(例如它不检查输入参数的数量),但你明白了。

所以在下之后:

enter image description here

您的自动变量 Count 将包含 200,而变量 Duration 将包含文本。

关于bash - 如何在单独的自动变量中获得这些结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25576397/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com