bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checkmail problem


From: Chris F.A. Johnson
Subject: Re: checkmail problem
Date: Thu, 03 May 2001 17:30:34 GMT

On Wed, 25 Apr 2001, Leung buggy wrote:

> i'm doing a assignment to write a script to check how many new mail i have
> under linux or unix.
>
> if [ $# -ne 0 ]
> then
>         echo $0 "take no parameter!!"
> else
>         no_mail=`mail -i | head -2 | tail -1 | cut -f2,3 -d' '`
>         check_mail=`echo $no_mail | cut -f2 -d' '`
>         if [ -z $check_mail ]
>         then
>                 echo "You have no mail"
>         else
>                 echo "You have" $no_mail
>         fi
> fi
>
> but the problem is "mail -i " need me to press 'q' to continue the run of
> script, is any better method to check how many new mail??

# adjust the address of INBOX if necessary
# (could be /var/spool/mail/$USER)
INBOX=/var/mail/$USER

grep ^From: $INBOX } wc -l

--
        Chris F.A. Johnson          address@hidden
        =================================================================
        address@hidden      http://cfaj.freeshell.org
        address@hidden      http://members.home.net/c.f.a.johnson




reply via email to

[Prev in Thread] Current Thread [Next in Thread]