<?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: scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213611#M899414</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you can bundle consequtive echos in a function.&lt;BR /&gt;&lt;BR /&gt;func1()&lt;BR /&gt;{&lt;BR /&gt;  echo "Start"&lt;BR /&gt;  echo "doing something"&lt;BR /&gt;  echo "finished"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;func1 2&amp;gt;&amp;amp;1 | tee -a /tmp/log_tee &lt;BR /&gt;&lt;BR /&gt;The other alternative would define&lt;BR /&gt;O=2&amp;gt;&amp;amp;1 | tee -a /tmp/log_tee &amp;gt;/tmp/log&lt;BR /&gt;echo "Try" $O&lt;BR /&gt;&lt;BR /&gt;BTW, what's the use of two copies in two files?&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
    <pubDate>Tue, 09 Mar 2004 12:45:15 GMT</pubDate>
    <dc:creator>Michael Schulte zur Sur</dc:creator>
    <dc:date>2004-03-09T12:45:15Z</dc:date>
    <item>
      <title>scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213607#M899410</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;The script:&lt;BR /&gt;_______________________&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo "Try" 2&amp;gt;&amp;amp;1 &amp;gt;/tmp/log&lt;BR /&gt;_______________________&lt;BR /&gt;is aquivalnt of:&lt;BR /&gt;_______________________&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;exec 2&amp;gt;&amp;amp;1&lt;BR /&gt;exec 1&amp;gt;/tmp/log&lt;BR /&gt;echo "Try"&lt;BR /&gt;_______________________&lt;BR /&gt;How can I modify the next one to use "exec" too?&lt;BR /&gt;_______________________&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo "Try" 2&amp;gt;&amp;amp;1 | tee -a /tmp/log_tee &amp;gt;/tmp/log&lt;BR /&gt;_______________________&lt;BR /&gt;I want to avoid using "2&amp;gt;&amp;amp;1 | tee -a /tmp/log_tee &amp;gt;/tmp/log" &lt;BR /&gt;after every "echo" command!&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Troy&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Mar 2004 12:13:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213607#M899410</guid>
      <dc:creator>Troyan Krastev</dc:creator>
      <dc:date>2004-03-09T12:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213608#M899411</link>
      <description>Depending on how interactive your script is, you could put parenthesis around the entire script-&lt;BR /&gt; &lt;BR /&gt;example-&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;(&lt;BR /&gt;echo "start of my process"&lt;BR /&gt;./myprocess&lt;BR /&gt;echo "end of my process"&lt;BR /&gt;) | tee -a /tmp/log_tee &amp;gt;/tmp/log&lt;BR /&gt; &lt;BR /&gt;Another method is to use the "script" command to log all output (and input).&lt;BR /&gt; &lt;BR /&gt;example-&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;script /tmp/log_tee&lt;BR /&gt;echo "start of my process"&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Tue, 09 Mar 2004 12:37:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213608#M899411</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-03-09T12:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213609#M899412</link>
      <description>exec is a global redirect. So once you have redirected stdout and stderr to /tmp/log all output goes there. If you then tee it you will get 2 entries in /tmp/log.&lt;BR /&gt;&lt;BR /&gt;The simplest way would be to&lt;BR /&gt;&lt;BR /&gt;tail -f /tmp/log&lt;BR /&gt;&lt;BR /&gt;in a different window.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave.</description>
      <pubDate>Tue, 09 Mar 2004 12:39:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213609#M899412</guid>
      <dc:creator>David Burgess</dc:creator>
      <dc:date>2004-03-09T12:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213610#M899413</link>
      <description>I'm not exactly sure here but this might save keystrokes at least.&lt;BR /&gt;&lt;BR /&gt;TMAN="2&amp;gt;&amp;amp;1 | tee -a /tmp/log_tee &amp;gt;/tmp/log" &lt;BR /&gt;&lt;BR /&gt;echo "stuff" $TMAN&lt;BR /&gt;&lt;BR /&gt;If the code does the job, why are we messing with it?&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 09 Mar 2004 12:39:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213610#M899413</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-03-09T12:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213611#M899414</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you can bundle consequtive echos in a function.&lt;BR /&gt;&lt;BR /&gt;func1()&lt;BR /&gt;{&lt;BR /&gt;  echo "Start"&lt;BR /&gt;  echo "doing something"&lt;BR /&gt;  echo "finished"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;func1 2&amp;gt;&amp;amp;1 | tee -a /tmp/log_tee &lt;BR /&gt;&lt;BR /&gt;The other alternative would define&lt;BR /&gt;O=2&amp;gt;&amp;amp;1 | tee -a /tmp/log_tee &amp;gt;/tmp/log&lt;BR /&gt;echo "Try" $O&lt;BR /&gt;&lt;BR /&gt;BTW, what's the use of two copies in two files?&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Mar 2004 12:45:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213611#M899414</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-03-09T12:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213612#M899415</link>
      <description>exec 2&amp;gt;&amp;amp;1&lt;BR /&gt;tee -a /tmp/log_tee &amp;gt;/tmp/log |&amp;amp;&lt;BR /&gt;exec 1&amp;gt;&amp;amp;p&lt;BR /&gt;&lt;BR /&gt;echo "try"</description>
      <pubDate>Tue, 09 Mar 2004 12:52:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213612#M899415</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-03-09T12:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213613#M899416</link>
      <description>Thank you all,&lt;BR /&gt;&lt;BR /&gt;All these work. Now it is up to me to choose a solution.&lt;BR /&gt;Steven: I have seen alot of ugly scripts in my live. They work, but it doesn't meen anything. &lt;BR /&gt;Michael: The real script does't use 2 log file. One of them is /dev/console&lt;BR /&gt;Curt: Your solution is interesting. &lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;Troy</description>
      <pubDate>Tue, 09 Mar 2004 13:51:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/3213613#M899416</guid>
      <dc:creator>Troyan Krastev</dc:creator>
      <dc:date>2004-03-09T13:51:27Z</dc:date>
    </item>
  </channel>
</rss>

