<?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: shell script question - redirect standard output in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856690#M937005</link>
    <description>You could also just redirect to /dev/tty &lt;BR /&gt;&lt;BR /&gt;Instead of using $TTY, redirect the output to /dev/tty.&lt;BR /&gt;&lt;BR /&gt;Good luck.&lt;BR /&gt;Olav Kappert&lt;BR /&gt;</description>
    <pubDate>Wed, 04 Dec 2002 18:28:48 GMT</pubDate>
    <dc:creator>.Olav Kappert.</dc:creator>
    <dc:date>2002-12-04T18:28:48Z</dc:date>
    <item>
      <title>shell script question - redirect standard output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856687#M937002</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am having the following problem in redirecting message to stdout.&lt;BR /&gt;&lt;BR /&gt;Senario 1:&lt;BR /&gt;Here is my script and it works fine if I logged as user A and run the script.&lt;BR /&gt;----------------------------&lt;BR /&gt;TTY=`tty`&lt;BR /&gt;&lt;BR /&gt;. /oracle/utils/orasid rendb&lt;BR /&gt;&lt;BR /&gt;echo test start  &amp;gt; $TTY&lt;BR /&gt;&lt;BR /&gt;(sqlplus /nolog &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;connect system/manager&lt;BR /&gt;host echo hai  &amp;gt; $TTY&lt;BR /&gt;exit&lt;BR /&gt;EOF&lt;BR /&gt;) &amp;gt; $HOME/sqllog.log&lt;BR /&gt;&lt;BR /&gt;echo test finish  &amp;gt; $TTY&lt;BR /&gt;---------------------------&lt;BR /&gt;The output is&lt;BR /&gt;-------------&lt;BR /&gt;test start&lt;BR /&gt;hai&lt;BR /&gt;test finish&lt;BR /&gt;------------&lt;BR /&gt;&lt;BR /&gt;Senario 2:&lt;BR /&gt;But it doesn't work if I logged on as user A then change user to ' su - B' because my terminal device (tty) is own by user A.&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;/bin/sh: /dev/ttyp2: Cannot create the specified file.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Then I have tried to use file descriptor &lt;BR /&gt;&lt;BR /&gt;exec 5&amp;gt;&amp;amp;1&lt;BR /&gt;. /oracle/utils/orasid rendb&lt;BR /&gt;&lt;BR /&gt;echo test start  &amp;gt;&amp;amp;5&lt;BR /&gt;&lt;BR /&gt;(sqlplus /nolog &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;connect system/ora99dba&lt;BR /&gt;host echo hai  &amp;gt;&amp;amp;5&lt;BR /&gt;exit&lt;BR /&gt;EOF&lt;BR /&gt;) &amp;gt; $HOME/sqllog.log&lt;BR /&gt;&lt;BR /&gt;echo test finish  &amp;gt;&amp;amp;5&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;test start&lt;BR /&gt;/bin/sh: /dev/ttyp2: Cannot create the specified file.&lt;BR /&gt;test finish.&lt;BR /&gt;&lt;BR /&gt;With the above method and still having the problem to display message 'hai' in the sql block above.&lt;BR /&gt;&lt;BR /&gt;The above script will be used in Senario 2. Does anyone know how to go about resolve the issue. &lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Dec 2002 18:23:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856687#M937002</guid>
      <dc:creator>Ridzuan Zakaria</dc:creator>
      <dc:date>2002-12-03T18:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: shell script question - redirect standard output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856688#M937003</link>
      <description>&lt;BR /&gt;REmove the redirection to $TTY&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 03 Dec 2002 18:26:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856688#M937003</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-12-03T18:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: shell script question - redirect standard output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856689#M937004</link>
      <description>&lt;BR /&gt;You could also just redirect to /dev/tty&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 03 Dec 2002 18:34:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856689#M937004</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-12-03T18:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: shell script question - redirect standard output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856690#M937005</link>
      <description>You could also just redirect to /dev/tty &lt;BR /&gt;&lt;BR /&gt;Instead of using $TTY, redirect the output to /dev/tty.&lt;BR /&gt;&lt;BR /&gt;Good luck.&lt;BR /&gt;Olav Kappert&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Dec 2002 18:28:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856690#M937005</guid>
      <dc:creator>.Olav Kappert.</dc:creator>
      <dc:date>2002-12-04T18:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: shell script question - redirect standard output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856691#M937006</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks everyone for your feedback. I have changed my script to use /dev/tty.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Dec 2002 18:31:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question-redirect-standard-output/m-p/2856691#M937006</guid>
      <dc:creator>Ridzuan Zakaria</dc:creator>
      <dc:date>2002-12-04T18:31:09Z</dc:date>
    </item>
  </channel>
</rss>

