【发布时间】:2017-01-11 21:59:13
【问题描述】:
我已经使用 Automator 创建了一个 macOS 服务,它实际上会将 Finder 中的每个文件附加到一个新的 Thunderbird 撰写窗口,并且只是一个简单的 bash 脚本。
for f in "$@"
do
open -a /Applications/Thunderbird.app/ "$f"
done
此服务也适用于任何文件夹,但可以肯定的是,您不能将文件夹附加到撰写窗口。但我现在的想法是让脚本检测文件是文档还是文件夹。如果是文件,请附上。如果是文件夹,请先将其压缩,然后再附加。顺便说一句:
if file is folder than
// zip compress folder
// attach *.zip to Thunderbird compose window
else // seems to be a document
// attach document to Thunderbird compose window
但是如何检测文件是否为文件夹,然后在 bash 脚本中将其压缩为 zip 文件?
【问题讨论】:
-
见:
help test | less
标签: bash macos zip thunderbird