Re: stop "You have mail in /var/mail/mike"
On Sat, Aug 09, 2025 at 17:31:59 -0500, Mike McClain wrote:
> I am running bash on a Raspberry PI 4B.
> mike@RPI4b3:~> uname -a
> Linux MikesPI 6.1.0-rpi7-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
> While not annoying on startup or when opening a new TTY, it is most annoying
> when entering a command on the commandline, breaking the command onto two lines with
> 'You have mail' in the midst. It will look like this:
> mike@RPI4b3:~> ls /mc/bYou have mail in /var/mail/mike
> in/my.*
> mike@RPI4b3:~> echo $MAIL
> /var/mail/mike
> You have mail in /var/mail/mike
> mike@RPI4b3:~> echo $MAILCHECK
> 0
OK, now *that* is weird. Bash doesn't check for mail while waiting
for you to finish typing a command. It only checks right before
displaying a prompt.
What you're seeing (mail check output while you're typing) sounds more
like there's a second process running, doing the checks, and writing
the messages to your terminal. Perhaps a second bash shell.
> This is set in a file pulled in by ~.bashrc as export MAILCHECK=0
> and has been for years.
Did this only start recently? What changed?
> Note the line between the echo statements that I just copied from tye CLI
> on another tty.
Right, *that* one looks normal.
I do apologize for a mis-statement in my previous email, though. Looking
at the man page for MAILCHECK again:
MAILCHECK
Specifies how often (in seconds) bash checks for mail. The de‐
fault is 60 seconds. When it is time to check for mail, the
shell does so before displaying the primary prompt. If this
variable is unset, or set to a value that is not a number
greater than or equal to zero, the shell disables mail checking.
I misread the part about "greater than or equal to zero". Setting
the MAILCHECK variable to 0 doesn't disable checking as I assumed it
would. It looks like you need to unset the variable, or set it to an
empty string, or a non-numeric value.
That should get rid of the normal checks, which happen before the prompt
is displayed. However, I don't know what process is writing the messages
while you're typing.
What does "ps" show is running on this terminal?
Reply to: