bourne mail script problem

Hey there,

Just have a quick question. i've written a program and it needs to
send a email to confirm it's completed. now i've done the

mail -s "Subject" test@test.com

the problem is the program, when run just waits. it doesn't execute the next command unless i press ^D. is there away for it to just send a mail without a body and go on without having to press ^D

thanks
priest_ridden

That because it's waiting on the body of the message to be included. If it's excluded it expects standard input to provide the content.

Over come it by trying ...
mail -s "Everest AU - CPU Monthly Report." \
TEST@TEST.com.au < $xcpudir\data/cpu$CurrYr$PrevMth\.data

Hope that helps - and that I've explained it clearly enough. :wink:

Ok, I think I get what you're saying.

< $xcpudir\data/cpu$CurrYr$PrevMth\.data

if i'm off let me know.

the first part is the current dir of the program and the rest just sends date information for the body so the progrm will keep running.

hope i understood that right.

thanks

well i looked at it some more and i figured it out thanks a lot
i just did this and it seems to work out

:smiley:

mail -s "Subject" test@test.com <usr/home/mail/$USER >/dev/null 2>&1

and now everything works just fine

Sorry, my example may not have been entirely understandable.

  1. To send a file to another user, enter:
    mail fran < proposal

    This command sends the contents of the file proposal to fran.

Hope that helps. :slight_smile:

Just saw your reply - you're quick.

Never knew about: mail -s "Subject."TEST@TEST.com /dev/null 2>&1

Learning something new everyday. :slight_smile:

I'd be even quicker if i would have used the code format before i typed my last message. lol

i think before the /dev/null that you need >

though i could be wrong