在 Ubuntu 上运行 Postfix 时,我在一个帐户中获得了一些测试电子邮件usr1
,现在我想在开始其他测试之前删除它们。但是,每次我尝试同时使用d #
“delete #”和“delete #”进行删除时,什么也没有发生。
例子:
usr1@usr1:~$ mail
"/var/mail/usr1": 5 messages 5 unread
>U 1 usr2 Tue Apr 30 15:54 19/478 Testing local mail
U 2 Mail Delivery Syst Tue Apr 30 15:54 78/2433 Undelivered Mail Returned to Sender
U 3 usr2 Tue Apr 30 15:55 19/614 Re: Testing local mail
U 4 usr2 Tue Apr 30 15:55 19/604 Re: Testing local mail
U 5 Mail Delivery Syst Tue Apr 30 15:55 73/2219 Undelivered Mail Returned to Sender
? d 1-5
? x
usr1@usr1:~$ mail
"/var/mail/usr1": 5 messages 5 unread
>U 1 usr2 Tue Apr 30 15:54 19/478 Testing local mail
U 2 Mail Delivery Syst Tue Apr 30 15:54 78/2433 Undelivered Mail Returned to Sender
U 3 usr2 Tue Apr 30 15:55 19/614 Re: Testing local mail
U 4 usr2 Tue Apr 30 15:55 19/604 Re: Testing local mail
U 5 Mail Delivery Syst Tue Apr 30 15:55 73/2219 Undelivered Mail Returned to Sender
? x
谁能解释这是为什么吗?另一个 Unix SE 帖子谈论使用该命令,因为我希望它能工作(当然,在 Solaris 中),但我不明白为什么这些邮件拒绝删除。
答案1
经过多次挖掘,我意识到问题是我总是退出mail
使用exit
or x
。来自Ubuntu 手册页:
exit (ex or x) Effects an immediate return to the shell without modifying
the user's system mailbox, his mbox file, or his edit
file in -f.
因此,如果您尝试删除电子邮件并使用d *
或d 1-5
等,则需要确保mail
使用quit
或离开q
。
我希望这可以避免其他人的困惑。