Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to mark ALL mail items as read? Post 302080205 by reborg on Monday 17th of July 2006 06:52:06 AM
Old 07-17-2006
Strange, this question was asked a couple of days ago, but I can't remember if I replied, so I'll do so this time.

If you have mailx you can:

delete *

otherwise

you could remove the mail spool for the user in question if you have the required permissions to do so.

or else do sometthing linke this:

Code:
#! /usr/bin/ksh
#
#
MAIL_INDEX_LIST=$(mail << EOF | sed -n 's/^[>     ][      ]*\([0-9][0-9]*\).*/\1/p'
h a
q
EOF
)

mail |&

for i in $MAIL_INDEX_LIST ; do
    print -p p $i   ### EDIT change d to p
done
print -p q


Last edited by reborg; 07-17-2006 at 12:54 PM..
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to read from mail

Hi, I have a requirement in which I have to read mail from a unix text file and scan records having failed records (any number > 0) Firstly it should compare the file creation_date with sysdate if the dates match then do the checking for failed records sample file i/p Staged 0... (0 Replies)
Discussion started by: misenkiser
0 Replies

2. UNIX for Dummies Questions & Answers

How do I read mail in /var/spool/mail?

How can I read mail sent to /var/spool/mail? I do not have pine installed so forget about that...is there some generic utility I can use? (3 Replies)
Discussion started by: mojoman
3 Replies

3. Shell Programming and Scripting

awk between items including items

OS=HP-UX ksh The following works, except I want to include the <start> and <end> in the output. awk -F '<start>' 'BEGIN{RS="<end>"; OFS="\n"; ORS=""} {print $2} somefile.log' The following work in bash but not in ksh sed -n '/^<start>/,/^<end>/{/LABEL$/!p}' somefile.log (4 Replies)
Discussion started by: Ikon
4 Replies

4. UNIX for Advanced & Expert Users

How to read mail attachement

I want to read attachements sent to unix mail id and save the attachement in folder. I may receive the mails from different mail clients(outlook, lotus ..etc). Attachements are in CSV(comma saperate) format. Let me know the shell script code for this. Regards, Venkat (1 Reply)
Discussion started by: svenkatareddy
1 Replies

5. Shell Programming and Scripting

script to read mail on a mail server

Hi All, Is there any way Unix shell script can directly read a mail on a mail server (for eg. abc@xyz.com) and save it as a text file in a unix directory ? Thanks PRKS ---------- Post updated at 08:37 AM ---------- Previous update was at 08:36 AM ---------- I am using ksh (1 Reply)
Discussion started by: PRKS
1 Replies

6. Shell Programming and Scripting

script to read mail

Hi, I want to write a script that will read mail ( for eg: from abc.def@yahoomail.com ). And if it finds a particular subject then do something.. Is it possible.... Please help... Thanks in adv.. (8 Replies)
Discussion started by: PRKS
8 Replies

7. UNIX for Dummies Questions & Answers

read mail question

how do I save a email I just read to a new file? Thanks. (3 Replies)
Discussion started by: drew211
3 Replies

8. Shell Programming and Scripting

Read a lis, find items in a file from the list, change each item

Hello, I have some tab delimited text data, file: final_temp1 aname val NAME;r'(1,) 3.28584 r'(2,)<tab> NAME;r'(3,) 6.13003 NAME;r'(4,) 4.18037 r'(5,)<tab> You can see that the data is incomplete in some cases. There is a trailing tab after the first column for each incomplete row. I... (2 Replies)
Discussion started by: LMHmedchem
2 Replies
MAIL(1) 						      General Commands Manual							   MAIL(1)

NAME
mail - send and receive electronic mail SYNOPSIS
mail [-dpqrv] [-f file] [user] OPTIONS
-d Force use of the shell variable MAILER -f Use file instead of /usr/spool/mail/user as mailbox -p Print all mail and then exit -q Quit program if SIGINT received -r Reverse print order, i.e., print oldest first -v Verbose mode EXAMPLES
mail ast # Send a message to ast mail # Read your mail DESCRIPTION
Mail is an extremely simple electronic mail program. It can be used to send or receive email on a single MINIX system, in which case it functions as user agent and local delivery agent. If the flag MAILER is defined in mail.c, it can also call a transport agent to handle remote mail as well. No such agent is supplied with MINIX. When called by user with no arguments, it examines the mailbox /usr/spool/mail/user, prints one message (depending on the -r flag), and waits for one of the following commands: <newline> Go to the next message - Print the previous message !command Fork off a shell and execute command CTRL-D Update the mailbox and quit (same as q) d Delete the current message and go to the next one q Update the mailbox and quit (same as CTRL-D) p Print the current message again s [file] Save message in the named file x Exit without updating the mailbox To send mail, the program is called with the name of the recipient as an argument. The mail is sent, along with a postmark line containing the date. For local delivery, a file named after the recipient in the directory /usr/spool/mail must be writable. If the directory /usr/spool/mail does not exist then the mail is dumped on the console, so that system programs have a way to notify a user on a system that does not have a mail spool. MAIL(1)
All times are GMT -4. The time now is 09:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy