![你能纠正这个bash吗](https://linux22.com/image/190209/%E4%BD%A0%E8%83%BD%E7%BA%A0%E6%AD%A3%E8%BF%99%E4%B8%AAbash%E5%90%97.png)
我能够管理列出所有邮件帐户,例如:
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