On Fri, 2004-12-24 at 07:29 +0000, Stroller wrote:
> On Dec 24, 2004, at 5:33 am, Phill Edwards wrote:
> 
> > When I run this command, all the output should go to /dev/null, I 
> > believe:
> >
> > $ mythfilldatabase --file 1 7 /home/mythtv/.xmltv/tvlistings.xml 2>&1
> >> /dev/null
> >
> > However, the output goes to screen, or to mail when I run it from
> > cron...
> 
> It's been a while since I looked at the syntax for this sorta stuff, 
> but in my cron I have a number of entries in the format:
>     /usr/bin/fetchmail  > /dev/null 2>&1
> which seem to do what you require.

That's correct, the order of the redirections matters

If you have a process with fd1->stdout and fd2->stderr then the first
command line gives you, (> is the same as 1>):
        2>&1            fd1->stdout, fd2->stdout
        1>/dev/null     fd1->/dev/null, fd2->stdout
which isn't what you want. Instead if you do
        1>/dev/null     fd1->/dev/null, fd2->stderr
        2>&1            fd1->/dev/null, fd2->/dev/null
then you get what you want. Instead of thinking too hard about it I
often just use "1>/dev/null 2>/dev/null" if that is what I want.

Ian.

-- 
Ian Campbell

Oh, I've seen copies [of Linux Journal] around the terminal room at The Labs.
        -- Dennis Ritchie

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

Reply via email to