<?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: redirection problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185835#M163779</link>
    <description>i dont know why ... but there are some things about this that i found. since i dont know your exact problem, guessed this may help you in whaterver it is you are trying.&lt;BR /&gt;&lt;BR /&gt;enclose the command within parenthesis or braces and you dont have the problem:&lt;BR /&gt;&lt;BR /&gt;ls nosuchfile 2&amp;gt;&amp;amp;1 &amp;gt;log   #doesnt work&lt;BR /&gt;(ls nosuchfile 2&amp;gt;&amp;amp;1) &amp;gt; log # works&lt;BR /&gt;{ ls nosuchfile 2&amp;gt;&amp;amp;1 \&lt;BR /&gt;} &amp;gt; log  #works&lt;BR /&gt;&lt;BR /&gt;also if you put the offending line within a script file and run it (redirecting stdout) it still works.</description>
    <pubDate>Mon, 09 Feb 2004 01:27:44 GMT</pubDate>
    <dc:creator>ranganath ramachandra</dc:creator>
    <dc:date>2004-02-09T01:27:44Z</dc:date>
    <item>
      <title>redirection problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185833#M163777</link>
      <description>Does any one tell me what is the diffrence,&lt;BR /&gt;between 1&amp;gt;#ls &amp;gt;file 2&amp;gt;&amp;amp;1  and&lt;BR /&gt;        2&amp;gt;#ls 2&amp;gt;&amp;amp;1 &amp;gt;file &lt;BR /&gt;why the 2nd cmd not redirecting the std error&lt;BR /&gt;to the file?&lt;BR /&gt;If any one knows anything pls let me know.&lt;BR /&gt;&lt;BR /&gt;Amit Singh&lt;BR /&gt;</description>
      <pubDate>Mon, 09 Feb 2004 01:04:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185833#M163777</guid>
      <dc:creator>amit singh_3</dc:creator>
      <dc:date>2004-02-09T01:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: redirection problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185834#M163778</link>
      <description>Well, you're right! My guess is that the shell parses from left to right so when it sees the "2&amp;gt;&amp;amp;1" it sets up standard error to whatever standard output is.  Standard output hasn't actually been re-directed yet so it is to your terminal.  Then the shell sees the "&amp;gt;file" and re-directs standard output to the file as you wanted.  However, standard error has already been re-directed to your screen.&lt;BR /&gt; &lt;BR /&gt;"kjk 2&amp;gt;&amp;amp;1 &amp;gt;file 2&amp;gt;&amp;amp;1" although stupid achieves what you would expect if the above paragraph is true.&lt;BR /&gt; &lt;BR /&gt;I think the point is that "2&amp;gt;&amp;amp;1" doesn't mean "glue" standard error to standard output but means direct standard error to wherever standard output happens to be right now.</description>
      <pubDate>Mon, 09 Feb 2004 01:17:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185834#M163778</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-02-09T01:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: redirection problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185835#M163779</link>
      <description>i dont know why ... but there are some things about this that i found. since i dont know your exact problem, guessed this may help you in whaterver it is you are trying.&lt;BR /&gt;&lt;BR /&gt;enclose the command within parenthesis or braces and you dont have the problem:&lt;BR /&gt;&lt;BR /&gt;ls nosuchfile 2&amp;gt;&amp;amp;1 &amp;gt;log   #doesnt work&lt;BR /&gt;(ls nosuchfile 2&amp;gt;&amp;amp;1) &amp;gt; log # works&lt;BR /&gt;{ ls nosuchfile 2&amp;gt;&amp;amp;1 \&lt;BR /&gt;} &amp;gt; log  #works&lt;BR /&gt;&lt;BR /&gt;also if you put the offending line within a script file and run it (redirecting stdout) it still works.</description>
      <pubDate>Mon, 09 Feb 2004 01:27:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185835#M163779</guid>
      <dc:creator>ranganath ramachandra</dc:creator>
      <dc:date>2004-02-09T01:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: redirection problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185836#M163780</link>
      <description>hey Mark,&lt;BR /&gt;Ur explanation is good.&lt;BR /&gt;do U have any document explaning the fact?&lt;BR /&gt;or do U have any info from where I will get&lt;BR /&gt;the HP internals book.&lt;BR /&gt;&lt;BR /&gt;thanks..&lt;BR /&gt;&lt;BR /&gt;Amit Singh</description>
      <pubDate>Mon, 09 Feb 2004 03:15:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185836#M163780</guid>
      <dc:creator>amit singh_3</dc:creator>
      <dc:date>2004-02-09T03:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: redirection problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185837#M163781</link>
      <description>I don't have any documentation, just far more experience than I care to admit.  However, I think careful reading of the sh-posix man page will probably indicate the reasoning here.</description>
      <pubDate>Mon, 09 Feb 2004 03:23:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185837#M163781</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-02-09T03:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: redirection problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185838#M163782</link>
      <description>Amit,&lt;BR /&gt;&lt;BR /&gt;check the man-page from sh-posix.&lt;BR /&gt;Quote:&lt;BR /&gt;&lt;BR /&gt;If any of the above redirections is preceded by a digit (0 to 9), the file descriptor used is the one specified by&lt;BR /&gt;the digit, instead of the default 0 (standard input) or 1 (standard output). For example:&lt;BR /&gt;2&amp;gt;&amp;amp;1&lt;BR /&gt;means open file descriptor 2 for writing as a duplicate of file descriptor 1. Output directed to file descriptor&lt;BR /&gt;2 is written in the same location as output to file descriptor 1.&lt;BR /&gt;Order is significant in redirection. The shell evaluates each redirection in terms of the (file descriptor, file)&lt;BR /&gt;assignment at the time of evaluation. For example:&lt;BR /&gt;1&amp;gt;fname 2&amp;gt;&amp;amp;1&lt;BR /&gt;first assigns file descriptor 1 to file fname. It then assigns file descriptor 2 to the file assigned to file&lt;BR /&gt;descriptor 1 (that is, fname).&lt;BR /&gt;If the order of redirection is reversed, as in&lt;BR /&gt;2&amp;gt;&amp;amp;1 1&amp;gt;fname&lt;BR /&gt;file descriptor 2 is assigned to the file assigned to file descriptor 1 (probably the terminal) and then file&lt;BR /&gt;descriptor 1 is assigned to file fname.&lt;BR /&gt;&lt;BR /&gt;JP.&lt;BR /&gt;&lt;BR /&gt;(Glad to help, bu if this answer or any of the above help you, would you assign some points?)</description>
      <pubDate>Mon, 09 Feb 2004 06:44:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/redirection-problem/m-p/3185838#M163782</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-02-09T06:44:55Z</dc:date>
    </item>
  </channel>
</rss>

