我已经创建了一个脚本,所以我可以搜索特定路径中的0kb文件,输出将被重定向到一个文本文件,然后通过电子邮件发送。该脚本的工作原理除了在电子邮件发送时或在脚本运行后查看时,fie都是空的。Bash脚本生成空文件
if [[ -n $(find /path/to/files/ -type f -empty -mmin +2) ]] then
> /tmp/output.txt ; mail -s "subject" -a /tmp/output.txt "[email protected]"
rm /tmp/ftr_output.txt
fi
不知道我是否错过了任何帮助,将不胜感激。
感谢
您已明确指示,'的/ tmp/output.txt'被__truncated__。你为什么期望内容在那里?你想达到什么目的? – devnull
我猜''/ tmp/output.txt'应该在'$()'里面 – technosaurus