<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: What does &#8220;&gt; /dev/null 2&gt;&#038;1&#8243; mean?</title>
	<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/</link>
	<description>Stay curious!</description>
	<pubDate>Sat, 06 Sep 2008 02:42:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: smg</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-15057</link>
		<author>smg</author>
		<pubDate>Fri, 22 Aug 2008 17:57:46 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-15057</guid>
		<description>"&#62; /dev/null 2&#62;&#38;1" mean?

action 1: STDOUT is redirected to /dev/null
action 2: STDERR is redirected to STDOUT

question 1: is the above action 1 &#38; action 2 is happening serial or parallel?

question 2: if the above actions happens in serial in which order do they happen? (action 1 -&#62; action2) /or/ (action 2 -&#62; action 1)

if the above questions are invalid then it means still I didn't understand it.  TIA.</description>
		<content:encoded><![CDATA[<p>&#8220;&gt; /dev/null 2&gt;&amp;1&#8243; mean?</p>
<p>action 1: STDOUT is redirected to /dev/null<br />
action 2: STDERR is redirected to STDOUT</p>
<p>question 1: is the above action 1 &amp; action 2 is happening serial or parallel?</p>
<p>question 2: if the above actions happens in serial in which order do they happen? (action 1 -&gt; action2) /or/ (action 2 -&gt; action 1)</p>
<p>if the above questions are invalid then it means still I didn&#8217;t understand it.  TIA.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14902</link>
		<author>Luke</author>
		<pubDate>Fri, 25 Jul 2008 07:09:50 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14902</guid>
		<description>Thanks. I didn't think I was going to get an answer for that :)</description>
		<content:encoded><![CDATA[<p>Thanks. I didn&#8217;t think I was going to get an answer for that :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wjs32246</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14901</link>
		<author>wjs32246</author>
		<pubDate>Fri, 25 Jul 2008 00:18:17 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14901</guid>
		<description>To Luke:

the reason that this command:

Command 1: wibble &#62;/mylogs/logfile 2&#62;&#38;1

works differently than this one:

Command 2: wibble 2&#62;&#38;1 &#62;/mylogs/logfiles

has to do with the way in which the shell processes the command line.  The shell deals with the I/O redirection tokens not as a totality, but rather in the sequence in which they appear; thus, in command 1, STDOUT is directed to logfile, then STDERR is directed to the same place as STDOUT, whereas in command 2, STDERR is directed to the terminal (because that's where STDOUT is directed at this time), *then* STDOUT is redirected to logfile.</description>
		<content:encoded><![CDATA[<p>To Luke:</p>
<p>the reason that this command:</p>
<p>Command 1: wibble &gt;/mylogs/logfile 2&gt;&amp;1</p>
<p>works differently than this one:</p>
<p>Command 2: wibble 2&gt;&amp;1 &gt;/mylogs/logfiles</p>
<p>has to do with the way in which the shell processes the command line.  The shell deals with the I/O redirection tokens not as a totality, but rather in the sequence in which they appear; thus, in command 1, STDOUT is directed to logfile, then STDERR is directed to the same place as STDOUT, whereas in command 2, STDERR is directed to the terminal (because that&#8217;s where STDOUT is directed at this time), *then* STDOUT is redirected to logfile.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wjs32246</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14900</link>
		<author>wjs32246</author>
		<pubDate>Fri, 25 Jul 2008 00:05:04 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14900</guid>
		<description>To Eric Dodemont and Dinesh:

It is not exactly correct to say that the command

Command 1: wibble &#62;/mylogs/logfile 2&#62;&#38;1

is equivalent to the command

Command 2: wibble &#62;/mylogs/logfile 2&#62;/mylogs/logfile

99.99% of the times you treat them identically, the result will be interchangeable, but if the wibble program generates both normal output on STDOUT and error messages on STDERR, you might notice a difference.

This gets really nit-picky, but here's the explanation.  Command 1 sets up a situation in which the process running wibble has a single I/O channel to /mylogs/logfile which is shared cooperatively by the STDOUT and STDERR pipes.  However, command 2 sets up a different situation in which there are TWO independent I/O channels to /mylogs/logfile, one used by the STDOUT pipe, and the other by the STDERR pipe.

In the single channel situation, there's a single location that keeps track of how the file is being written - specifically the position in the file for the next write.  In the dual channel case, there are two separate and uncoordinated locations tracking the position of the next write.

The end result is that in the single channel case, the logfile receives output and error messages in the sequence in which they are generated by the wibble program, but in the dual channel case, error messages tend to overwrite normal output and vice-versa.

So, if the wibble program would normally run like this:

wibble
This is a line of output.
error 1

This command:

wibble &#62;/mylogs/logfile 2&#62;&#38;1

will generate a logfile that looks like this:

This is a line of output.
error 1

Whereas this command:

wibble &#62;/mylogs/logfile 2&#62;/mylogs/logfile

generates a logfile that looks like this:

error 1 a line of output.</description>
		<content:encoded><![CDATA[<p>To Eric Dodemont and Dinesh:</p>
<p>It is not exactly correct to say that the command</p>
<p>Command 1: wibble &gt;/mylogs/logfile 2&gt;&amp;1</p>
<p>is equivalent to the command</p>
<p>Command 2: wibble &gt;/mylogs/logfile 2&gt;/mylogs/logfile</p>
<p>99.99% of the times you treat them identically, the result will be interchangeable, but if the wibble program generates both normal output on STDOUT and error messages on STDERR, you might notice a difference.</p>
<p>This gets really nit-picky, but here&#8217;s the explanation.  Command 1 sets up a situation in which the process running wibble has a single I/O channel to /mylogs/logfile which is shared cooperatively by the STDOUT and STDERR pipes.  However, command 2 sets up a different situation in which there are TWO independent I/O channels to /mylogs/logfile, one used by the STDOUT pipe, and the other by the STDERR pipe.</p>
<p>In the single channel situation, there&#8217;s a single location that keeps track of how the file is being written - specifically the position in the file for the next write.  In the dual channel case, there are two separate and uncoordinated locations tracking the position of the next write.</p>
<p>The end result is that in the single channel case, the logfile receives output and error messages in the sequence in which they are generated by the wibble program, but in the dual channel case, error messages tend to overwrite normal output and vice-versa.</p>
<p>So, if the wibble program would normally run like this:</p>
<p>wibble<br />
This is a line of output.<br />
error 1</p>
<p>This command:</p>
<p>wibble &gt;/mylogs/logfile 2&gt;&amp;1</p>
<p>will generate a logfile that looks like this:</p>
<p>This is a line of output.<br />
error 1</p>
<p>Whereas this command:</p>
<p>wibble &gt;/mylogs/logfile 2&gt;/mylogs/logfile</p>
<p>generates a logfile that looks like this:</p>
<p>error 1 a line of output.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14897</link>
		<author>Michael</author>
		<pubDate>Thu, 24 Jul 2008 00:49:14 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14897</guid>
		<description>And if you just want to hide STDERR output (for instance if you're creating a bunch of system vars), you can say 2&#62;/dev/null.

export VAR=`command that causes lots of error output 2&#62;/dev/null`</description>
		<content:encoded><![CDATA[<p>And if you just want to hide STDERR output (for instance if you&#8217;re creating a bunch of system vars), you can say 2&gt;/dev/null.</p>
<p>export VAR=`command that causes lots of error output 2&gt;/dev/null`</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bheemboy</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14748</link>
		<author>bheemboy</author>
		<pubDate>Mon, 16 Jun 2008 16:03:04 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14748</guid>
		<description>thanks it helped me a lot</description>
		<content:encoded><![CDATA[<p>thanks it helped me a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinesh</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14416</link>
		<author>Dinesh</author>
		<pubDate>Tue, 08 Apr 2008 04:27:32 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14416</guid>
		<description>Thanks Jt...</description>
		<content:encoded><![CDATA[<p>Thanks Jt&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jt</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14413</link>
		<author>jt</author>
		<pubDate>Mon, 07 Apr 2008 16:10:49 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14413</guid>
		<description>Ryan:
wibble  &#62;./2 2&#62;&#38;1

Dinesh - see VJ's comment above for your first question.
your second question is also answered in the original post and comments:
ls 2&#62;stderr.log</description>
		<content:encoded><![CDATA[<p>Ryan:<br />
wibble  &gt;./2 2&gt;&amp;1</p>
<p>Dinesh - see VJ&#8217;s comment above for your first question.<br />
your second question is also answered in the original post and comments:<br />
ls 2&gt;stderr.log</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinesh</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14412</link>
		<author>Dinesh</author>
		<pubDate>Mon, 07 Apr 2008 08:36:13 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14412</guid>
		<description>Also, Is it possible to redirect only the STDERR error message to any log file (without redirecting program output to STDOUT)</description>
		<content:encoded><![CDATA[<p>Also, Is it possible to redirect only the STDERR error message to any log file (without redirecting program output to STDOUT)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dinesh</title>
		<link>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14411</link>
		<author>Dinesh</author>
		<pubDate>Mon, 07 Apr 2008 08:26:08 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/#comment-14411</guid>
		<description>&#62;/dev/null 2&#62;&#38;1

is equivalent to

&#62;/dev/null 2&#62;/dev/null?

Then can we say like, "&#38;" is used to trace the direction where 1 (STDOUT) directed?</description>
		<content:encoded><![CDATA[<p>&gt;/dev/null 2&gt;&amp;1</p>
<p>is equivalent to</p>
<p>&gt;/dev/null 2&gt;/dev/null?</p>
<p>Then can we say like, &#8220;&amp;&#8221; is used to trace the direction where 1 (STDOUT) directed?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
