In this section you will learn how to control where your shell looks for mail and when and how it tells you that new mail has arrived. These are options you can control within your shell startup files. You can also set a variety of mail options in mail's own startup file, .mailrc. For information about the options you can set in .mailrc, see mail(C).
Depending on the shell you are using, you can specify where mail is looked for by setting the MAILPATH or the MAIL variable. Again, depending on your shell, you can control how often you are notified of new mail by setting the MAILCHECK or MAIL variable.
To tell your shell where to look for mail, set the appropriate variable to the pathname where you receive your mail. (Generally, you receive mail in /usr/spool/mail/loginname, where loginname is your login name. If you are unsure about where you receive your mail, ask your system administrator.) With sh and ksh, you can tell your shell how you want to be prompted for new mail using this same variable setting.
To set your mail path and new mail message in sh, add the following line to your .profile:
MAILPATH=pathname%messageHere pathname is the pathname and message is the message you want to be prompted with. For example:
MAILPATH=/usr/spool/mail/susannah%Yo, you've got some new mailTo set your mail path in ksh, add the following line to your .profile or .kshrc:
MAILPATH=pathname?messageThis is the same as with the Bourne shell, only you use a ? to introduce the message you want to see. If you leave out the message, sh prints
you have new mailand ksh prints
You have new mail.
To set your mail path in csh, add the following line to your .login or .cshrc:
set MAILPATH=pathnameHere pathname is the pathname from where you want your mail read. csh prompts you with
You have new mailwhen new mail arrives; you cannot change this.
By default, each shell checks for mail every 10 minutes. You can change this by specifying a new time in seconds. In sh or ksh, add the following line to your .profile or .kshrc:
MAILCHECK=secondsHere seconds is the number of seconds you want to go by before the shell checks for new mail again. For example, if you want your ksh or sh shell to check for mail every half hour:
MAILCHECK=1800In csh, if you want to change how often the shell checks for mail, you need to add the new number of seconds before the pathname in the MAIL variable. To tell your csh to check for new mail every half hour:
set MAIL=(1800 /usr/spool/mail/susannah)