我能够管理列出所有邮件帐户,例如:
for dir in /home/*/mail/*/*; do
echo "$dir" | awk -F"/" '{print $6"@"$5}' done
Results:
[email protected]
[email protected]
etc...
但我无法像这样完成这项工作:
for dir in /home/*/mail/*/*; do
doveadm expunge -u "$dir" mailbox '*' savedbefore 100days | awk -F"/" '{print $6"@"$5}'
done
工作命令是:
doveadm expunge -u [email protected] mailbox '*' savedbefore 100days
我对 bash 一无所知,但我觉得纠正语法很容易。那么可以请您更正一下吗?
答案1
我建议:
for dir in /home/*/mail/*/*; do
dir=$(echo "$dir" | awk -F"/" '{print $6"@"$5}')
doveadm expunge -u "$dir" mailbox '*' savedbefore 100days
done