Date: Fri, 10 Oct 2003 15:42:02 -0500 From: Dan Nelson <dnelson@allantgroup.com> To: freebsd-questions@freebsd.org Subject: Re: Redirect to /dev/null Message-ID: <20031010204202.GF77306@dan.emsphone.com> In-Reply-To: <20031010202755.GA74202@beast.clarksys.com> References: <20031010202755.GA74202@beast.clarksys.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Oct 10), Max Clark said:
> What is the proper way to redirect output to /dev/null? I've been
> using the following in my crontab but output is still ending up in my
> mailbox.
>
> ... 2>&1 > /dev/null
I'm sure this is in a sh FAQ someplace:
What you did was dup fd1 onto fd2, then redirect fd1 to /dev/null:
fd1 -> stdout fd2 -> stderr
2>&1
fd1 -> stdout fd2 -> stdout
>/dev/null
fd1 -> /dev/null fd2 -> stdout
Swap the two redirects, so you redirect fd1 to /dev/null, then dup it
onto fd2:
fd1 -> stdout fd2 -> stderr
>/dev/null
fd1 -> /dev/null fd2 -> stdout
2>&1
fd1 -> /dev/null fd2 -> /dev/null
--
Dan Nelson
dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031010204202.GF77306>
