Aix:为什么程序邮件忽略mbox设置?

Aix:为什么程序邮件忽略mbox设置?

在 AIX 上,我希望邮件程序使用 /root/.mbox 而不是默认的 /root/mbox。我编辑mailrc

vim.mailrc

设置MBOX=/root/.mbox

结果并不好

mail
Mail [5.2 UCB] [AIX 5.X]  Type ? for help.
"/var/spool/mail/root": 2 messages 2 unread
>U  1 root              Tue Jun 22 01:48  13/349 
 U  2 root              Tue Jun 22 01:49  13/349 
? 1
Message  1:
From root Tue Jun 22 01:48:58 2021
Date: Tue, 22 Jun 2021 01:48:58 +0200
From: root
To: root

hello

? q
Saved 1 message in /root/mbox
Held 1 message in /var/spool/mail/root

我尝试过不同的设置,例如 mailrc 上的设置

set MBOX=/root/.mbox
set MBOX /root/.mbox
set mbox /root/.mbox
set mbox=/root/.mbox

但仍保存到 /root/mbox

答案1

找到解决方案,而不是使用此方法,在旧的 Unix 操作系统(如 Sco Unix System V)上有效

myname@scosysv:/usr/myname$ vi .mailrc
".mailrc" 1 line, 19 characters 
set MBOX=/usr/myname/.mbox


myname@scosysv:/usr/myname$ echo hello|mail myname
myname@scosysv:/usr/myname$ mail
SCO System V Mail (version 3.2)  Type ? for help.
"/usr/spool/mail/myname": 1 message 1 new
>N  1 myname         Tue Jun 22 02:04    8/215  
& 1
Message  1:
From myname Tue Jun 22 02:04:28 2021
From: [email protected] ()
X-Mailer: SCO System V Mail (version 3.2)
To: myname
Date: Tue, 22 Jun 2021 2:04:28 PDT
Message-ID:  <[email protected]>
Status: R

hello
& save
"/usr/myname/.mbox"[New file] 8/215
& Held 0 messages in /usr/spool/mail/myname.

在AIX上我们使用这个方法

export MBOX=/root/.mbox

echo hello|mail root
mail
Mail [5.2 UCB] [AIX 5.X]  Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N  1 root              Tue Jun 22 02:16  12/339 
? 1
Message  1:
From root Tue Jun 22 02:16:25 2021
Date: Tue, 22 Jun 2021 02:16:25 +0200
From: root
To: root

hello

? save
"/root/.mbox" [Appended] 12/339

当然,可以将变量添加到 shell 的 .bashrc 文件或 rc 文件中。

相关内容