<?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: ksh script, unbuffering(?) output in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495083#M830490</link>
    <description>Thanks for the replies. I am not sure we have gawk so I might try the same thing in perl.&lt;BR /&gt;&lt;BR /&gt;I had thought about the tail option but did really like the idea of looping through a tail for 6 hours till the background job completed.&lt;BR /&gt;&lt;BR /&gt;I am intrigued by Marcel's idea, but I am not sure what you mean by wrapping the statements in a script command? These statements are already in a shell script with a few other housekeeping statements. How do I wrap them in a script command?&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
    <pubDate>Thu, 22 Feb 2001 18:46:16 GMT</pubDate>
    <dc:creator>Ben Spencer</dc:creator>
    <dc:date>2001-02-22T18:46:16Z</dc:date>
    <item>
      <title>ksh script, unbuffering(?) output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495079#M830486</link>
      <description>I am trying to capture the output from a program and display the output on the display, AND check the return status from the program. I have managed to figure out at least on way to do this (see statement below) but there is one problem: the output to both the screen and the file is buffered (apparently) and is not shown in a timely manner. I would like the output to appear on the screen as soon as it is generated. Is there a way to force the buffer to be flushed after each line displayed? If I don't use the subshell and just redirect the output to tee I think the ouptut shows up in a timely way. For certain it does if I just put the output to the screen. Thanks.&lt;BR /&gt;&lt;BR /&gt;here is the statement I am using:   (/opt/omni/sbin/omnidbutil -readascii -mmdb $workdir -cdb $workdir;echo $?&amp;gt;$raerrcd) &amp;lt;&lt;EOF 2=""&gt;&amp;amp;1 | tee -a  $fileout&lt;BR /&gt;Y&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;I echo the return status ($?) to the file $raerrcd inside the subshell so that I can retrieve it and check it later. Outside the subshell I redirect all the output to tee so that output goes to both the display and the file $fileout. In addition there is input required by the program that is provided in the last two lines via the redirection &amp;lt;&lt;/EOF&gt;</description>
      <pubDate>Fri, 16 Feb 2001 18:48:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495079#M830486</guid>
      <dc:creator>Ben Spencer</dc:creator>
      <dc:date>2001-02-16T18:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, unbuffering(?) output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495080#M830487</link>
      <description>The problem is with 'tee'.  I don't think there is any way to make it not buffer.  If you have gawk, you can do something like...&lt;BR /&gt;&lt;BR /&gt;(omnidbutil -readascii -mmdb $workdir -cdb $workdir;echo $?&amp;gt;$raerrcd) &amp;lt;&lt;EOF 2=""&gt;&amp;amp;1 | awk '{print &amp;gt;&amp;gt; "outfile";print;fflush("")}'&lt;BR /&gt;&lt;BR /&gt;Regular awk doesn't support fflush().&lt;BR /&gt;-sam&lt;/EOF&gt;</description>
      <pubDate>Fri, 16 Feb 2001 22:24:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495080#M830487</guid>
      <dc:creator>Sam Nicholls</dc:creator>
      <dc:date>2001-02-16T22:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, unbuffering(?) output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495081#M830488</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Not sure if this would work, but if the problem is with the tee, could you wrap your statements in a script command?&lt;BR /&gt;&lt;BR /&gt;This should get all the output to the logfile and, I think, to the display as well.  As far as I know there's no buffering.&lt;BR /&gt;&lt;BR /&gt;Marcel</description>
      <pubDate>Mon, 19 Feb 2001 09:28:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495081#M830488</guid>
      <dc:creator>Marcel_3</dc:creator>
      <dc:date>2001-02-19T09:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, unbuffering(?) output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495082#M830489</link>
      <description>&lt;BR /&gt;You can control the this jobs with tail -f &lt;BR /&gt; &lt;BR /&gt;(/opt/omni/sbin/omnidbutil -readascii -mmdb $workdir -cdb $workdir;echo $?&amp;gt;$raerrcd) &amp;lt;&lt;EOF&gt; $fileout 2&amp;gt;&amp;amp;1 &amp;amp; &lt;BR /&gt;&lt;BR /&gt;tail -f $fileout&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/EOF&gt;</description>
      <pubDate>Mon, 19 Feb 2001 15:14:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495082#M830489</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2001-02-19T15:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, unbuffering(?) output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495083#M830490</link>
      <description>Thanks for the replies. I am not sure we have gawk so I might try the same thing in perl.&lt;BR /&gt;&lt;BR /&gt;I had thought about the tail option but did really like the idea of looping through a tail for 6 hours till the background job completed.&lt;BR /&gt;&lt;BR /&gt;I am intrigued by Marcel's idea, but I am not sure what you mean by wrapping the statements in a script command? These statements are already in a shell script with a few other housekeeping statements. How do I wrap them in a script command?&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Thu, 22 Feb 2001 18:46:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495083#M830490</guid>
      <dc:creator>Ben Spencer</dc:creator>
      <dc:date>2001-02-22T18:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: ksh script, unbuffering(?) output</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495084#M830491</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Sorry, looks like I've caused confusion.&lt;BR /&gt;&lt;BR /&gt;Your running a shell script, but, if before you run it you type:&lt;BR /&gt;&lt;BR /&gt;script logfile.log&lt;BR /&gt;&lt;BR /&gt;and then do a Ctrl-D after your shell script has finished you'll end up with a file called logfile.log which should contain all the output from the shell script.&lt;BR /&gt;&lt;BR /&gt;Of course, rather than typing it at the command line you can bung it in a wrapper for your existing shell script.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Marcel</description>
      <pubDate>Fri, 23 Feb 2001 13:23:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-unbuffering-output/m-p/2495084#M830491</guid>
      <dc:creator>Marcel_3</dc:creator>
      <dc:date>2001-02-23T13:23:43Z</dc:date>
    </item>
  </channel>
</rss>

