Mailx:有没有一种方法可以使用FIFO代替LIFO使用(主题“字符串”)从邮箱中获取邮件?

时间:2019-05-24 20:10:17

标签: unix mailx

我有一个脚本,该脚本从邮箱中读取并处理在主题行中包含特定文本的邮件。当前mailx会获取与搜索字符串匹配的最新项,但是有没有办法让mailx来获取第一项?

例如:

$ mailx
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/oracle": 3 messages
>   1 Doe, John  Fri May 24 14:56 260/12654 "RE: Test mail"
    2 Doe, John  Fri May 24 15:00 287/13577 "RE: Test mail"
    3 Doe, John  Fri May 24 15:35 341/15417 "RE: Test mail"

$ echo "(subject Test)" | mailx > testMail.txt
$ cat testMail.txt

"/var/spool/mail/oracle": 3 messages
>   1 Doe, John  Fri May 24 14:56 260/12654 "RE: Test mail"
    2 Doe, John  Fri May 24 15:00 287/13577 "RE: Test mail"
    3 Doe, John  Fri May 24 15:35 341/15417 "RE: Test mail"
Message  3:
From john.doe@mail.com  Fri May 24 15:35:25 2019
...

testMail.txt将包含3号电子邮件的内容,但我希望能够在列表中以1号电子邮件开头。

0 个答案:

没有答案