Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法使用 mailx 将消息保存到文件中,只使用命令行?我知道我可以通过首先输入 mailx 将消息复制到文件中:
mailx -A my_account
然后输入
& c 1-10 first_ten_messages.txt
这会将前 10 条消息保存到文件中。
我想做的是类似的事情,但没有互动部分。所以像:
mailx -A my_account --options "c 1-10 first_ten_messages.txt"
这可能吗?
谢谢
这应该这样做。
echo 'c 1-10 first_ten_messages.txt' | mailx -A my_account
如果要选择来自特定发件人的邮件,可以运行类似的命令:
echo 'c from "Baji Boo" from_baji_boo.txt' | mailx -A my_account.
需要注意的是,它from使用封装的名称,而不是直接的电子邮件地址。
from
一般来说,跑步mailx和打字h会给你很好的信息和阅读man mailx。
mailx
h
man mailx
您可以以不同的方式搜索消息并使用该方法保存到文件中echo。
echo