<?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: redirecting stdin &amp;amp; stdout in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/redirecting-stdin-amp-stdout/m-p/2660449#M929070</link>
    <description>lsf 2&amp;gt;&amp;amp;1 &amp;gt;&amp;gt;/tmp/filename&lt;BR /&gt;&lt;BR /&gt;2&amp;gt;&amp;amp;1 to capture all output, then the redirection to the appropriate destination.&lt;BR /&gt;&lt;BR /&gt;Share and Enjoy! Ian</description>
    <pubDate>Thu, 07 Feb 2002 09:03:05 GMT</pubDate>
    <dc:creator>ian Dennison</dc:creator>
    <dc:date>2002-02-07T09:03:05Z</dc:date>
    <item>
      <title>redirecting stdin &amp; stdout</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirecting-stdin-amp-stdout/m-p/2660448#M929069</link>
      <description>hi all,&lt;BR /&gt;&lt;BR /&gt;I am having trouble getting the 2&amp;gt;&amp;amp;1 ethic to work&lt;BR /&gt;&lt;BR /&gt;I am simply trying :&lt;BR /&gt;lsf 2&amp;gt;&amp;amp;1 redirect_test&lt;BR /&gt;&lt;BR /&gt;1- The statement won't work if the file is not previously created (??)&lt;BR /&gt;2- If the file is created, the output(s) are still not written&lt;BR /&gt;&lt;BR /&gt;I know this is basic, but I just can't get it to work. (I have also tried an example from the HP certified book - can't get that to work either)&lt;BR /&gt;&lt;BR /&gt;any help will be much appreciated,&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;John</description>
      <pubDate>Thu, 07 Feb 2002 08:59:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirecting-stdin-amp-stdout/m-p/2660448#M929069</guid>
      <dc:creator>u856100</dc:creator>
      <dc:date>2002-02-07T08:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: redirecting stdin &amp; stdout</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirecting-stdin-amp-stdout/m-p/2660449#M929070</link>
      <description>lsf 2&amp;gt;&amp;amp;1 &amp;gt;&amp;gt;/tmp/filename&lt;BR /&gt;&lt;BR /&gt;2&amp;gt;&amp;amp;1 to capture all output, then the redirection to the appropriate destination.&lt;BR /&gt;&lt;BR /&gt;Share and Enjoy! Ian</description>
      <pubDate>Thu, 07 Feb 2002 09:03:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirecting-stdin-amp-stdout/m-p/2660449#M929070</guid>
      <dc:creator>ian Dennison</dc:creator>
      <dc:date>2002-02-07T09:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: redirecting stdin &amp; stdout</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirecting-stdin-amp-stdout/m-p/2660450#M929071</link>
      <description>The following works just as well, and is less confusing:&lt;BR /&gt;lsf 1&amp;gt;redirect_test 2&amp;gt;redirect_test &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Feb 2002 09:22:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirecting-stdin-amp-stdout/m-p/2660450#M929071</guid>
      <dc:creator>Deepak Extross</dc:creator>
      <dc:date>2002-02-07T09:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: redirecting stdin &amp; stdout</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirecting-stdin-amp-stdout/m-p/2660451#M929072</link>
      <description>Hi John,&lt;BR /&gt;&lt;BR /&gt;It appears you are trying to redirect standard output (file descriptor 1) and standard error (fd 2) to redirect_test.  Bear with me in this explanation.&lt;BR /&gt;&lt;BR /&gt;In Bourne shell and its derivitives (ie Korn and Posix) output to a file can be redirected with #&amp;gt; where # is the file descriptor number (1 = stdout, 2 = stderr, others as defined by the process).  The default for # is 1.  Therefore 1&amp;gt; is the same as &amp;gt;.  So to redirect stdout use &amp;gt;outfile.  To redirect stderr use 2&amp;gt;errfile.  To redirect stdout and stderr to the same file use:&lt;BR /&gt;command &amp;gt;file 2&amp;gt;&amp;amp;1&lt;BR /&gt;Note that with 2&amp;gt;&amp;amp;1 stderr (fd 2) is redirected to the same file as stdout (fd 1).&lt;BR /&gt;&lt;BR /&gt;The order in which redirection is specified is important.  Consider the following 2 examples:&lt;BR /&gt;command &amp;gt;outfile 2&amp;gt;&amp;amp;1&lt;BR /&gt;command 2&amp;gt;&amp;amp;1 &amp;gt;outfile&lt;BR /&gt;&lt;BR /&gt;The first example redirects stdout to outfile then redirects stderr to the same file used by stdout (outfile).  Thus output and errors are written to outfile.&lt;BR /&gt;&lt;BR /&gt;The second example redirects stderr to the same file used by stdout which since stdout has yet to be redirected is by default the screen.  Then stdout is redirected to outfile.  The result is that output is written to outfile but errors are written to the screen.&lt;BR /&gt;&lt;BR /&gt;Test the above as follows:&lt;BR /&gt;mkdir testdir&lt;BR /&gt;cd testdir&lt;BR /&gt;ls junk &amp;gt;outfile 2&amp;gt;&amp;amp;1&lt;BR /&gt;ls junk 2&amp;gt;&amp;amp;1 &amp;gt;outfile&lt;BR /&gt;&lt;BR /&gt;Finally, to your problem.&lt;BR /&gt;lsf 2&amp;gt;&amp;amp;1 redirect_test&lt;BR /&gt;redirect_test is being seen as an argument to lsf.  It it does not exist, you get the error "redirect_test not found".  The error is sent to stderr which is redirected to the same file as stdout and is printed on the screen.  If redirect_test exists, the lsf command writes "redirect_test" to stdout (the screen).&lt;BR /&gt;&lt;BR /&gt;The commonly used syntax you need is:&lt;BR /&gt;lsf &amp;gt;redirect_test 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;The more fully qualified syntax (with the same results as the commonly used syntax) is:&lt;BR /&gt;lsf 1&amp;gt;redirect_test 2&amp;gt;redirect_test&lt;BR /&gt;&lt;BR /&gt;See the man pages for sh-bourne or sh-posix for more info.  Also, if you use csh, man csh.  csh is a much different animal.&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Thu, 07 Feb 2002 14:49:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirecting-stdin-amp-stdout/m-p/2660451#M929072</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2002-02-07T14:49:16Z</dc:date>
    </item>
  </channel>
</rss>

