Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script

Status
Not open for further replies.

juankayce

Programmer
May 22, 2002
1
US
i need help writing a script
vi post
You Have (number) messages from:
(name)@(Address)

and if no mail it will say
Sorry?No mail!

please help
juan
 
Hi Juan,

Have a look at the grep command, it allows you to look through text files and search for various things.

Also -- there's an option for the mail command that just checks to see it there's any mail. Mike
________________________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Hi Juan
This should do most of what you want;

grep "(name)@(Address)" post > /dev/null 2>&1
if [ $? != 0 ]
then
"You have mail"
else
echo "no mail found at ${DATE}"
fi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top