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!

Scripting advice for a noob. While loop, email management.

Status
Not open for further replies.

estcst

Technical User
Aug 20, 2006
1
US
I am trying to write a basic script to do mail management for an account I have on a Solaris system. I want for the mail to delete the last 50 mails I received. This will delete 1000-950 as I get a large number of e-mails daily and my maximum e-mails are 1000. I'm not sure how to pass off a command to have it delete the mail.

Here's what I tried with no real results:

mail
set mdjc = 0
while [ $mdjc -lt 50 ]
do
echo d $mdjc
mdjc = $mdjc + 1
done


Does anyone have any insight into this or even a different method to manage a users inbox using a script?
 
Hi

When you start the [tt]mail[/tt] program, it enters interactive mode and the next commands in the script will be executed only after the [tt]mail[/tt] exits.

Code:
for ((i=950;i<=1000;i++)); do echo "d$i"; done | mail

[gray]# or, if you have all 1000 mails[/gray]

echo "d950-1000" | mail

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top