Show if I have new mail in .profile ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Show if I have new mail in .profile ?
# 1  
Old 10-22-2008
Show if I have new mail in .profile ?

Is there any way to script it to tell me if I have new mail when I log-in? I'm using the bash shell.

It's showing up now already but I want to put a clear in my .profile to clear the screen of the disclaimer I've seen 1000 times, I have a few echo's and a command to list the number of users currently on the system.

If I knew where the file was that showed that disclaimer i could copy the code to display if I have new e-mails or not.

I'm mainly doing this to learn, I know there's an easy way out and just not put a clear in my .profile, but I'd rather learn more about scripting. Smilie
# 2  
Old 10-22-2008
Ok, what I came up with is

grep -c "Message-Id" /usr/mail/[myusername]

To get the count of message-id's, that doesn't mean 'new' but it will give me a 'list' of the e-mails in my inbox.
# 3  
Old 10-22-2008
Code:
mailx -e

does nothing if there is no new mail.
# 4  
Old 10-22-2008
Quote:
Originally Posted by jim mcnamara
Code:
mailx -e

does nothing if there is no new mail.
Doesn't do anything for me, new mail or not. I'll look into the command though, thank you.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

3. UNIX for Dummies Questions & Answers

Extract out mail ID from from profile list

HI, i HAVE THE PROFILE LIST ldapsearch -D cn=root -w root -p 389 mail=dgmp_ndl@bsnl.in mail=dgmp_ndl@bsnl.in,o=Data Networks,o=Data Networks,o=Data Networks,o=Messagingdb,dc=bsnl,dc=in I NEED TO SEPERATE ONLY THE MAIL ID I m USING bash-2.05b$ ldapsearch -D cn=root -w root -p 389... (3 Replies)
Discussion started by: indoo.pathak
3 Replies

4. Infrastructure Monitoring

trap in etc/profile and user .profile

Hello I really wonder what's trap in etc/profile and in each user .profile. I try to google for it but I think I have no luck. Mostly hit is SNMP traps which I think it is not the same thing. I want to know ... 1. What's a "trap 2 3" means and are there any other value I can set... (4 Replies)
Discussion started by: Smith
4 Replies

5. UNIX for Dummies Questions & Answers

difference between /etc/profile and .profile?

What is the difference between /etc/profile and .profile? (5 Replies)
Discussion started by: gehlnar
5 Replies

6. Solaris

how to forward mail in /var/mail/username to external mail

Dear All, Now I use solaris 10 and I try to forward mail from /var/mail/username to their external mail so what should I do? thank u in advance (2 Replies)
Discussion started by: unitipon
2 Replies

7. SCO

Difference between .profile and .~/.profile

what is the difference between these two lines, if we use it in korn shell script: .profile .~/.profile (3 Replies)
Discussion started by: maneesh mehta
3 Replies

8. UNIX for Dummies Questions & Answers

changed .profile but didnt ./.profile, yet reflected changes

hi , i added ls -F to .profile. and i need to do ./.profile for the effect to take effect BUT i didnt and YET the next day when i came to work and log in, the changes took effect. i am on aix. please explain.. thanks (4 Replies)
Discussion started by: yls177
4 Replies

9. UNIX for Dummies Questions & Answers

mail problem (NOT Mail or Mail.app)

When I try to use the CLI mail, I get the following error. What's wrong? Welcome to Darwin! % mail root Subject: test test . EOT % /etc/mail/sendmail.cf: line 81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory Do I just need to change the... (1 Reply)
Discussion started by: chenly
1 Replies
Login or Register to Ask a Question