【发布时间】:2013-12-06 03:33:40
【问题描述】:
我有这样的功能
myText(){
echo "Title: ${1}"
echo "Text: ${2}"
}
title="ABC"
text="123"
document=/tmp/temp.txt
myText "${title}" "${text}"
while read line; do
fillText "${title}" "${text}"
done < "${document}"
... 以及接收选定文本的 Automator 工作流程。
以前我使用的是 ruby 脚本。像这样将内容传递给它是没有问题的:
while read line; do
fillText "${title}" "${text}" | /usr/bin/somescript.rb
done < "${document}"
但是,现在我需要将内容传递给自动化工作流。
Automator 可以运行这样的工作流程:
automator [-v] [-i input] [-D name=value ...] workflow
所以我尝试了:
while read line; do
output=$(fillText "${title}" "${text}")
automator -i "${output}" ~/Library/Services/myAutomator.workflow
done < "${document}"
它不起作用。有大佬知道怎么弄吗?
PS:输出有多行。
【问题讨论】: