<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Redirect standard error in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840478#M95835</link>
    <description>Well, Ryan, being mathematically limited is a personal problem but it's not too late to fix. In all seriousness, once the bunch of engineers that I once had to support saw that I could handle differential equations, it was duck soup. Of course, I told them it was alright to be engineers; at least they weren't chemists. Using "The Force" I sense that you are probably supporting a bunch of guys doing Finite Element Analysis; if so, I am very familiar with the vendor supplied C Shell scripts and they were ugly. You may also be doing CFD but I really sense FEA. In my case, the only reason the C shell was used was to increase soft data ulimit values which both the Korn and POSIX shells now do.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 15 Aug 2006 11:24:36 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2006-08-15T11:24:36Z</dc:date>
    <item>
      <title>Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840468#M95825</link>
      <description>Hi unix experts:&lt;BR /&gt;&lt;BR /&gt;I have an engineer who insists upon using the C shell and he asked me a very simple question. How can I redirect standout output and standard error to separate files? I have read the man page many times and dones searches but my best attempt simply combines standard output and standard error into one file.&lt;BR /&gt;&lt;BR /&gt;Here is as close as I have been able to do:&lt;BR /&gt;&lt;BR /&gt;% find . -print &amp;gt;&amp;amp;/tmp/file1&lt;BR /&gt;&lt;BR /&gt;but that also includes all of the "find: cannot open xxxx" error messages.&lt;BR /&gt;&lt;BR /&gt;This should be so easy but I just can't seem to get the syntax right.&lt;BR /&gt;&lt;BR /&gt;Please help.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ryan</description>
      <pubDate>Wed, 09 Aug 2006 11:36:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840468#M95825</guid>
      <dc:creator>Ryan Clerk</dc:creator>
      <dc:date>2006-08-09T11:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840469#M95826</link>
      <description>First, get a baseball bat and whack your engineer with a baseball bat for using csh -- it is evil incarnate. Secondly, you question is simple and the answer is equally simple, "you can't (at least not directly)". I remember fighting this problem decades ago and this is the way to outbushwhack the C shell:&lt;BR /&gt;&lt;BR /&gt;(find . -print &amp;gt; /var/tmp/mystdout) &amp;gt;&amp;amp;/var/tmp/mystderr&lt;BR /&gt;&lt;BR /&gt;As you have discovered the "&amp;gt;&amp;amp;" redirects both stdout and stderr but I cheated by starting a sub-process and redirecting stdout inside it so that outside the sub-process all that is really left is the output from stderr.&lt;BR /&gt;&lt;BR /&gt;Oh, and don't feel bad because it took me hours to find this trick the first time I needed it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Aug 2006 11:42:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840469#M95826</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-09T11:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840470#M95827</link>
      <description>Hi Ryan:&lt;BR /&gt;&lt;BR /&gt;You should find this classic document helpful in solving your problem *and* perhaps convincing to your engineer that there are far better tools than 'csh':&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/" target="_blank"&gt;http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 09 Aug 2006 11:51:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840470#M95827</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-08-09T11:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840471#M95828</link>
      <description>Hi Ryan,&lt;BR /&gt;&lt;BR /&gt;While Jim's approach of getting your engineer to read a paper might work, it assumes that the engineer can read (and that he is willing to read it, if able). The "whack" approach makes no assumptions and is guaranteed to work. Seriously, there is really no good reason to run csh these days and most scripts can be easily converted. Many, many years ago there was no easy way to set ulimits for data and stack within the Bourne shell and the csh supported it --- allowing the soft ulimits to be increased. That was a valid reason for using it but ksh and POSIX also allow these values to be set, so that reason has gone away.&lt;BR /&gt;&lt;BR /&gt;Food for thought, Clay&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Aug 2006 12:00:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840471#M95828</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-09T12:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840472#M95829</link>
      <description>from "man csh"&lt;BR /&gt;exactly...26th page in csh man page:&lt;BR /&gt;----------------------------------------&lt;BR /&gt;&lt;BR /&gt; &amp;gt;&amp;gt; name&lt;BR /&gt;           &amp;gt;&amp;gt;&amp;amp; name&lt;BR /&gt;           &amp;gt;&amp;gt;! name&lt;BR /&gt;           &amp;gt;&amp;gt;&amp;amp;! name      Uses file name as standard output the same as &amp;gt;,&lt;BR /&gt;                          but appends output to the end of the file.  If the&lt;BR /&gt;                          variable noclobber is set, it is an error for the&lt;BR /&gt;                          file not to exist unless one of the ! forms is&lt;BR /&gt;                          given.  Otherwise, it is similar to &amp;gt;.&lt;BR /&gt;----------------------------------------&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Aug 2006 12:03:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840472#M95829</guid>
      <dc:creator>inventsekar_1</dc:creator>
      <dc:date>2006-08-09T12:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840473#M95830</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Thanks to everybody. Clay, your solution worked! JRF, I am just a lowly IT worker and engineers are engineers and know their approach is always superior. Sekar, I had already read the man pages.&lt;BR /&gt;&lt;BR /&gt;The bat may be a little drastic but it is tempting!&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;Ryan&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Aug 2006 12:16:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840473#M95830</guid>
      <dc:creator>Ryan Clerk</dc:creator>
      <dc:date>2006-08-09T12:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840474#M95831</link>
      <description>Well, Ryan, I've done IT support for engineers and I've had no trouble making them listen after I had earned their respect. It's actually rather easy -- just know more Calculus than they do. In any event, if you can convince them that there are few valid reasons to stick with the C shell these days then the biggest hurdle is converting the scripts. Have a look at this:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.isc.org/index.pl?/sources/utils/shell/korner.php" target="_blank"&gt;http://www.isc.org/index.pl?/sources/utils/shell/korner.php&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I've used the korner utility with varying degrees of success but it will actually convert most well-written csh scripts to their equivalent Korn (which is close enough for HP-UX's POSIX) shell scripts.&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Aug 2006 12:23:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840474#M95831</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-09T12:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840475#M95832</link>
      <description>If the engineer is so superior to you, why is he/she asking such a simple question. :) Clearly they should have no need for such a lowly IT worker as yourself, and be able to solve the problem on their own. &lt;BR /&gt;&lt;BR /&gt;Personally I take the "Sorry I don't support the antiquated csh shell anymore, if you wish to begin using a more current shell I will  happily instruct you in its proper use." *Attitude*   &lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Aug 2006 12:46:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840475#M95832</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2006-08-09T12:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840476#M95833</link>
      <description>While agree with the majority of the responses&lt;BR /&gt;this far, I can't resist pointing out that the&lt;BR /&gt;csh-whynot FAQ is a firm condemnation for csh&lt;BR /&gt;*programming*. I know plenty of old-timers that&lt;BR /&gt;still prefer csh as their interactive shell. It's&lt;BR /&gt;not clear from the base post if the engineer in&lt;BR /&gt;question is writing shell scripts. &lt;BR /&gt;&lt;BR /&gt;I came to UNIX later if life and started&lt;BR /&gt;straightaway with ksh, not because I had heard&lt;BR /&gt;that csh was inherently evil, but because it&lt;BR /&gt;lacked command line editing (readline-style&lt;BR /&gt;command line editing).  However, old (bad) habits&lt;BR /&gt;die hard.  Vi is the shining example. Again,&lt;BR /&gt;coming to UNIX somewhat later in life I had to&lt;BR /&gt;laugh at vi and went straight to emacs (with&lt;BR /&gt;custom bindings so it behaved like editors I was&lt;BR /&gt;used to). &lt;BR /&gt;&lt;BR /&gt;Bottom line is that engineers can certainly get&lt;BR /&gt;set in their ways despite things that offer&lt;BR /&gt;obvious productivity improvements such as csh -&amp;gt;&lt;BR /&gt;&lt;ANY other="" shell="" -=""&gt;, vi -&amp;gt; vim or emacs. The&lt;BR /&gt;whack with a 2x4 approach, while satisfying in the&lt;BR /&gt;short term, seldom is the best method to move&lt;BR /&gt;these folks. They are stubborn enough, and usually&lt;BR /&gt;sophisticated enough to KNOW that csh is bad and&lt;BR /&gt;they should move... But a shell, like an editor,&lt;BR /&gt;is a pretty large comfort zone/acquired taste and&lt;BR /&gt;hard to move from.  It's just a matter of their&lt;BR /&gt;current priorities. Usually it's seeing how other&lt;BR /&gt;tools/approaches offer large productivity boosts&lt;BR /&gt;that gets them to move. Peer pressure works best&lt;BR /&gt;here.&lt;BR /&gt;&lt;BR /&gt;So I'm guessing that this engineer is an older&lt;BR /&gt;gentleman/gentlewoman who's been around UNIX for a&lt;BR /&gt;while (although I agree that that doesn't quite&lt;BR /&gt;fit the profile since the average csh user knows&lt;BR /&gt;this trick and has read the whynot FAQ). IOW, this&lt;BR /&gt;is not some young Turk who has capriciously&lt;BR /&gt;latched on to csh. So instead of the 2x4, just&lt;BR /&gt;wish him luck. Make it clear that this is the tip&lt;BR /&gt;of the iceberg so he's going to need it. And if&lt;BR /&gt;he's the never read the whynot FAQ, you should be&lt;BR /&gt;tattooing it on his forehead. It's his first step &lt;BR /&gt;toward a long recovery ;-)&lt;BR /&gt;&lt;/ANY&gt;</description>
      <pubDate>Mon, 14 Aug 2006 14:02:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840476#M95833</guid>
      <dc:creator>PeterWolfe</dc:creator>
      <dc:date>2006-08-14T14:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840477#M95834</link>
      <description>Hi guys:&lt;BR /&gt;&lt;BR /&gt;Thanks for all the ideas but there is one fact that I omitted. My boss is an engineer  and he usually sides with the other engineers. His attitude is give them want they want. Clay, my college math ended with College Algebra so I can't impress them with my knowledge of math. This one engineer is an older guy but he has passed on many of his ideas to the younger engineers. These are mainly scripts that have been around for a very long time that occasionally need some minor changes.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ryan&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Aug 2006 10:58:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840477#M95834</guid>
      <dc:creator>Ryan Clerk</dc:creator>
      <dc:date>2006-08-15T10:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840478#M95835</link>
      <description>Well, Ryan, being mathematically limited is a personal problem but it's not too late to fix. In all seriousness, once the bunch of engineers that I once had to support saw that I could handle differential equations, it was duck soup. Of course, I told them it was alright to be engineers; at least they weren't chemists. Using "The Force" I sense that you are probably supporting a bunch of guys doing Finite Element Analysis; if so, I am very familiar with the vendor supplied C Shell scripts and they were ugly. You may also be doing CFD but I really sense FEA. In my case, the only reason the C shell was used was to increase soft data ulimit values which both the Korn and POSIX shells now do.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Aug 2006 11:24:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840478#M95835</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-15T11:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840479#M95836</link>
      <description>The following command saves stdout and stderr to the files "out.txt" and "err.txt", respectively. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;[root@server /root]# ./cmd 1&amp;gt;out.txt 2&amp;gt;err.txt&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The following command appends stdout and stderr to the files "out.txt" and "err.txt", respectively. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;[root@server /root]# ./cmd 1&amp;gt;&amp;gt;out.txt 2&amp;gt;&amp;gt;err.txt&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The following command functions similar to the above two commands, but also copies stdout and stderr to the files "stdout.txt" and "stderr.txt", respectively. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;[root@server /root]# (((./cmd | tee stdout.txt) 3&amp;gt;&amp;amp;1 1&amp;gt;&amp;amp;2 2&amp;gt;&amp;amp;3\&lt;BR /&gt;|tee stderr.txt) 3&amp;gt;&amp;amp;1 1&amp;gt;&amp;amp;2 2&amp;gt;&amp;amp;3) 1&amp;gt;out.txt 2&amp;gt;err.txt&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Wed, 16 Aug 2006 03:53:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840479#M95836</guid>
      <dc:creator>Srinivas Sreekumar</dc:creator>
      <dc:date>2006-08-16T03:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840480#M95837</link>
      <description>Note that this was a C shell question so the last solution proposed is a non sequitur --- although valid for other (and arguably better) shells.&lt;BR /&gt;</description>
      <pubDate>Wed, 16 Aug 2006 13:01:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840480#M95837</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-08-16T13:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Redirect standard error</title>
      <link>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840481#M95838</link>
      <description>Ryan,&lt;BR /&gt;&lt;BR /&gt;Redirect stdout first, then redirect to stderr&lt;BR /&gt;&lt;BR /&gt;(find / -name foo -print &amp;gt; ~/bar) &amp;amp;&amp;gt; ~/bat&lt;BR /&gt;&lt;BR /&gt;would be equivalent to &lt;BR /&gt;&lt;BR /&gt;find / -name foo -print 1&amp;gt; ~/bar 2&amp;gt; ~/bat &lt;BR /&gt;&lt;BR /&gt;in bash/korn&lt;BR /&gt;&lt;BR /&gt;not that&lt;BR /&gt; &lt;BR /&gt;( find / -name gimp -print &amp;gt; foo ) &amp;gt; &amp;amp; /dev/null &amp;amp;;tail -f foo is as easy as 2&amp;gt;/dev/null, but...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Apr 2007 14:57:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/redirect-standard-error/m-p/3840481#M95838</guid>
      <dc:creator>Mike Seidel</dc:creator>
      <dc:date>2007-04-25T14:57:36Z</dc:date>
    </item>
  </channel>
</rss>

