[ydl-gen] Sending mail from the command line

Joseph E. Sacco, Ph.D. joseph_sacco at comcast.net
Fri Sep 8 21:36:25 MDT 2006


Eric,

"> /dev/null 2>&1 " takes any output directed to stdout or stderr and
redirects it to the bit bucket, /dev/null. 

Specifically:
* redirect stdout to /dev/null

   > /dev/null

* redirect stderr to stdout

   2>&1


A construct like this is often used in a crontab entry. 

-Joseph

=========================================================================



If you use a construct like this in a crontab file, you 
On Fri, 2006-09-08 at 23:17 -0400, Eric Dunbar wrote:
> On 07/09/06, Joseph E. Sacco, Ph.D. <joseph_sacco at comcast.net> wrote:
> > Of course, a pipe should work, assuming sendmail is running. Here is an
> > example:
> >
> >     % ls | mail -s "output of ls"  jsacco > /dev/null 2>&1
> 
> Question time:
> 
> What does the "> /dev/null 2>&1" do?
> 
> I understand that the | is the 'pipe' and it redirects the output from
> the first command to the input for the second but what do the
> following arguments do?:
> '>'
> '/dev/null 2'
> '>&1'
> 
> When I try:
> ls | mail -s "output of ls"  username > /dev/null 2>&1
> 
> and
> 
> ls | mail -s "output of ls"  username
> 
> I get the same e-mail with either command.
> 
> Thanks, Eric.
> _______________________________________________
> yellowdog-general mailing list
> yellowdog-general at lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
> HINT: to Google archives, try  '<keywords> site:terrasoftsolutions.com'
-- 
joseph_sacco [at] comcast [dot] net



More information about the yellowdog-general mailing list