Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Script to check new email
Results 1 to 2 of 2

Thread: Script to check new email

Hybrid View

  1. #1

    Script to check new email

    Hello Guys,

    I am trying to write a script, which will check is there a new email or not.

    Code:
    #!/usr/bin/sh
    
            while true
            do
                    mail -E
                    #stat=`echo $status`
                    echo $status
                    if [  echo "$status" -eq 0 ]
                    then
                            echo There is new e-Mail to read.
                            exit 1
                    else
                            echo No new e-Mail.
                            sleep 30
                            continue
                    fi
            done
    It is directly printing "There is new e-Mail to read." and terminating program eventhough there is no email.

    Is anyone can help me?


  2. #2
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811
    your if[] condition isn't correct
    Code:
    #!/usr/bin/sh
            while true
            do
                     if [  `mail -e` -eq 0 ]
                    then
                            echo There is new e-Mail to read.
                            exit 1
                    else
                            echo No new e-Mail.
                    fi
                    sleep 30
            done
    would be a better way, altho it hasn't been tested.
    Don't worry Ma'am. We're university students, - We know what We're doing.
    'Ruiat coelum, fiat voluntas tua.'
    Datalogi - en livsstil; Intet liv, ingen stil.

Similar Threads

  1. command in bash script to check if tar is currupt or not
    By expresstom in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 05-15-2011, 09:07 PM
  2. Probs in a script called from another script
    By Outlaw in forum Programming
    Replies: 1
    Last Post: 03-12-2004, 02:54 PM
  3. script to check log file....
    By boblucci in forum Programming
    Replies: 3
    Last Post: 11-20-2003, 07:19 AM
  4. To email or not to Email, what was my question?
    By Rastar in forum Linux - Hardware, Networking & Security
    Replies: 8
    Last Post: 03-07-2002, 01:26 AM
  5. check out....
    By creedon in forum General Chat
    Replies: 8
    Last Post: 02-25-2002, 11:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •