<?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: unix script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210281#M326010</link>
    <description>&amp;gt;Would you be able to explain the lines:&lt;BR /&gt;"exec 3&amp;gt;&amp;amp;1 4&amp;gt;&amp;amp;2 &amp;gt;$LOGFILE 2&amp;gt;&amp;amp;1" &amp;amp; "exec 1&amp;gt;&amp;amp;3 2&amp;gt;&amp;amp;4"&lt;BR /&gt;&lt;BR /&gt;This is shell trickery.&lt;BR /&gt;Basically it dups file 1 to file 3 and file 2 to file 4 (saves them).&lt;BR /&gt;Then the second one puts those files back.</description>
    <pubDate>Thu, 05 Jun 2008 01:51:25 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-06-05T01:51:25Z</dc:date>
    <item>
      <title>unix script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210275#M326004</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I need some help with a unix script. Basically, I would like the script to email to me a log that it generated. The line that generates the script is :&lt;BR /&gt;&lt;BR /&gt;exec &amp;gt; /test/`basename $0`_`date +%d-%b-%H:%M`.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;Is is correct for me to issue the next line in the script as :&lt;BR /&gt;&lt;BR /&gt;mailx -s "Log file" myname@mymail.com &amp;lt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;Not sure if this makes sense as I'm a newbie at writing scripts.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Jun 2008 07:48:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210275#M326004</guid>
      <dc:creator>so.nimda</dc:creator>
      <dc:date>2008-06-04T07:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: unix script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210276#M326005</link>
      <description>no, you redirect output to a file&lt;BR /&gt;&lt;BR /&gt;LOGFILE="test/`basename $0`_`date +%d-%b-%H:%M`.log"&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;gt;&amp;amp;1 4&amp;gt;&amp;amp;2 &amp;gt;$LOGFILE 2&amp;gt;&amp;amp;1  &lt;BR /&gt;&lt;BR /&gt;mailx -s "...." &amp;lt;$LOGFILE&lt;BR /&gt;exec 1&amp;gt;&amp;amp;3 2&amp;gt;&amp;amp;4 # to get back the previous output.</description>
      <pubDate>Wed, 04 Jun 2008 09:50:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210276#M326005</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2008-06-04T09:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: unix script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210277#M326006</link>
      <description>take a look @ man uuencode to attach a fileto your mail.there is some example as well to help you out&lt;BR /&gt;&lt;BR /&gt;Cheers</description>
      <pubDate>Wed, 04 Jun 2008 10:38:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210277#M326006</guid>
      <dc:creator>marvik</dc:creator>
      <dc:date>2008-06-04T10:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: unix script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210278#M326007</link>
      <description>uuencode &lt;PATH&gt; &lt;NEWFILENAME&gt; | mailx -m -s "subject" email@domain.name&lt;BR /&gt;&lt;BR /&gt;The -m is required when attaching a file using mailx on HP-UX.&lt;BR /&gt;&lt;BR /&gt;Example&lt;BR /&gt;&lt;BR /&gt;uuencode /tmp/mylog.log mylog.doc | mailx -m -s "my important log" someone@important.ca&lt;BR /&gt;&lt;BR /&gt;This will send the mylog.log but rename it as mylog.doc.  Handy when you receive the email.  When you double click the attachment it will open in Word or whichever app is setup to open .doc files.&lt;BR /&gt;&lt;BR /&gt;&lt;/NEWFILENAME&gt;&lt;/PATH&gt;</description>
      <pubDate>Wed, 04 Jun 2008 11:57:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210278#M326007</guid>
      <dc:creator>OFC_EDM</dc:creator>
      <dc:date>2008-06-04T11:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: unix script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210279#M326008</link>
      <description>Hi Laurent Menase,&lt;BR /&gt;&lt;BR /&gt;Thanks for your reply.&lt;BR /&gt;&lt;BR /&gt;Would you be able to explain the lines :&lt;BR /&gt;&lt;BR /&gt;"exec 3&amp;gt;&amp;amp;1 4&amp;gt;&amp;amp;2 &amp;gt;$LOGFILE 2&amp;gt;&amp;amp;1" &amp;amp; "exec 1&amp;gt;&amp;amp;3 2&amp;gt;&amp;amp;4"&lt;BR /&gt;&lt;BR /&gt;I know that 0 is stdin, 1 is stdout, 2 is stderr but what's 3 &amp;amp; 4? I'm really not good at this - apologies.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Jun 2008 00:19:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210279#M326008</guid>
      <dc:creator>so.nimda</dc:creator>
      <dc:date>2008-06-05T00:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: unix script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210280#M326009</link>
      <description>Hi marvik &amp;amp; Kevin_Urschatz,&lt;BR /&gt;&lt;BR /&gt;Thanks for your replies.&lt;BR /&gt;&lt;BR /&gt;That's a very elegant way of doing it !&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 05 Jun 2008 00:23:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210280#M326009</guid>
      <dc:creator>so.nimda</dc:creator>
      <dc:date>2008-06-05T00:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: unix script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210281#M326010</link>
      <description>&amp;gt;Would you be able to explain the lines:&lt;BR /&gt;"exec 3&amp;gt;&amp;amp;1 4&amp;gt;&amp;amp;2 &amp;gt;$LOGFILE 2&amp;gt;&amp;amp;1" &amp;amp; "exec 1&amp;gt;&amp;amp;3 2&amp;gt;&amp;amp;4"&lt;BR /&gt;&lt;BR /&gt;This is shell trickery.&lt;BR /&gt;Basically it dups file 1 to file 3 and file 2 to file 4 (saves them).&lt;BR /&gt;Then the second one puts those files back.</description>
      <pubDate>Thu, 05 Jun 2008 01:51:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210281#M326010</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-06-05T01:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: unix script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210282#M326011</link>
      <description>Yes it is exactly that&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;gt;&amp;amp;1 4&amp;gt;&amp;amp;2 &amp;gt;afile.log 2&amp;gt;anotherfile.log&lt;BR /&gt;save fildescriptor 1 to 3 and 2 to 4&lt;BR /&gt;before redirecting them to files&lt;BR /&gt;&lt;BR /&gt;and after to put back the filedesc in place&lt;BR /&gt;better way&lt;BR /&gt;exec 1&amp;gt;&amp;amp;3 2&amp;gt;&amp;amp;4 3&amp;lt;&amp;amp;- 4&amp;lt;&amp;amp;-&lt;BR /&gt; 3&amp;lt;&amp;amp;- 4&amp;lt;&amp;amp;- close the dupped fildescripor after   recovering the initial outputs</description>
      <pubDate>Thu, 05 Jun 2008 04:10:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210282#M326011</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2008-06-05T04:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: unix script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210283#M326012</link>
      <description>Hi Dennis &amp;amp; Laurent,&lt;BR /&gt;&lt;BR /&gt;Thanks so much for the help and explanation.&lt;BR /&gt;&lt;BR /&gt;Laurent : I've tried your script and it worked beautifully. Thanks once again !</description>
      <pubDate>Thu, 05 Jun 2008 05:44:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-script/m-p/4210283#M326012</guid>
      <dc:creator>so.nimda</dc:creator>
      <dc:date>2008-06-05T05:44:53Z</dc:date>
    </item>
  </channel>
</rss>

