LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-29-2010, 08:17 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
Bash: How to use $(fetchmail | head -n 1) to make a beep at any new email received?


Hello,

How to watch and make a beep at change of the output : fetchmail -k | head -n 1 ? What could be the best way in bash ?

Last edited by frenchn00b; 05-29-2010 at 08:20 AM.
 
Old 05-29-2010, 09:36 AM   #2
antegallya
Member
 
Registered: Jun 2008
Location: Belgium
Distribution: Debian
Posts: 109

Rep: Reputation: 42
Hello,
Something like :
Code:
while true
do
  fetchmail -ks && beep
  sleep 300
done
fetchmail exit status is 0 if there is new mail and non zero if no new mail or error.
I don't know if you want your fetchmail to actually *fetch* the mail. But if don't want to, use 'fetchmail -cs' instead of '-k' so that it only check if there is new mail.
beep can be the one of the beep command (package beep on debian) with customized beeps.

Hope this helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
receive and parse email in bash (or execute script when message is received) Guyverix Linux - Newbie 2 11-15-2009 07:29 AM
Beating my head against the email wall - cannot receive email dazed-and-confused Linux - Server 16 09-02-2008 05:14 AM
Pipe'ing the ouput of 'cat' into 'mutt' (email) losses newlines when email received helptonewbie Linux - Newbie 2 08-28-2008 03:16 AM
Archiving both received and sent email? neocookie Linux - Server 3 09-26-2007 09:13 AM
How do I: convert my fetchmail email file to separate email files? ancientt Linux - Software 1 02-03-2003 02:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration