<?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: Help on Script needed in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223628#M170802</link>
    <description>The simplest way is to use the "&amp;amp;&amp;amp;" operator which will only allow the things on the right of it to run if the thing on the left is succesful.&lt;BR /&gt; &lt;BR /&gt;rcp -p /sdata/files/cptester/r1.txt a646001:/home/amartir/main_unix.txt &amp;amp;&amp;amp; mycommand&lt;BR /&gt; &lt;BR /&gt;If "mycommand" needs to be several commands you can put them in braces as in &lt;BR /&gt; &lt;BR /&gt;rcp -p /sdata/files/cptester/r1.txt a646001:/home/amartir/main_unix.txt &amp;amp;&amp;amp; {&lt;BR /&gt; mailx .....&lt;BR /&gt; rm ....&lt;BR /&gt; etc ...&lt;BR /&gt;}&lt;BR /&gt; &lt;BR /&gt;The opposite of &amp;amp;&amp;amp; is ||</description>
    <pubDate>Fri, 19 Mar 2004 05:30:07 GMT</pubDate>
    <dc:creator>Mark Grant</dc:creator>
    <dc:date>2004-03-19T05:30:07Z</dc:date>
    <item>
      <title>Help on Script needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223621#M170795</link>
      <description>Hi all&lt;BR /&gt;&lt;BR /&gt;Below is a sample of the script I'm working on. I cannot remember how to do the "no error" bit. Please help.&lt;BR /&gt;&lt;BR /&gt;rcp -p /sdata/files/cptester/r1.txt a646001:/home/amartir/main_unix.txt&lt;BR /&gt;IF no error THEN&lt;BR /&gt;      mailx -s"Copy of Main_Unix to DSA" elit&lt;BR /&gt;      rm /sdata/files/cptester/r1.txt;;&lt;BR /&gt;rcp -p /sdata/files/cptester/r2.txt a646001:/home/amartir/sub_unix.txt&lt;BR /&gt;IF no error THEN&lt;BR /&gt;      mailx -s"Copy of Sub_Unix to DSA" elit&lt;BR /&gt;      rm /sdata/files/cptester/r2.txt;;</description>
      <pubDate>Fri, 19 Mar 2004 04:09:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223621#M170795</guid>
      <dc:creator>Rudi Martin</dc:creator>
      <dc:date>2004-03-19T04:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Script needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223622#M170796</link>
      <description>Hi,&lt;BR /&gt;You can try with:&lt;BR /&gt;&lt;BR /&gt;if [ $? -eq 0 ]&lt;BR /&gt;&lt;BR /&gt;$? is exit error code, and if it is 0 the command properly.&lt;BR /&gt;&lt;BR /&gt;Boris.&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 04:13:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223622#M170796</guid>
      <dc:creator>Borislav Perkov</dc:creator>
      <dc:date>2004-03-19T04:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Script needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223623#M170797</link>
      <description>if [ $? -eq 0 ]&lt;BR /&gt;then &lt;BR /&gt;   command&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;sks</description>
      <pubDate>Fri, 19 Mar 2004 04:15:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223623#M170797</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-03-19T04:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Script needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223624#M170798</link>
      <description>or you can use the double pipe "||" to specify an action to take if the operation fails, eg:&lt;BR /&gt;rcp -p /sdata/files/cptester/r1.txt a646001:/home/amartir/main_unix.txt || return 1&lt;BR /&gt;&lt;BR /&gt;mailx -s"Copy of Main_Unix to DSA" &lt;BR /&gt;&lt;BR /&gt;etc&lt;BR /&gt;&lt;BR /&gt;-- Graham&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 04:17:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223624#M170798</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2004-03-19T04:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Script needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223625#M170799</link>
      <description>Beware that r services connot be trusted as for the return code.&lt;BR /&gt;rcp return code should be ok, but if're doing rsh, a good idea is to make the remote script display a final OK and the local caller grep this output.&lt;BR /&gt;&lt;BR /&gt;For the test :&lt;BR /&gt;if [ $? -eq 0 ] ; then&lt;BR /&gt;   command&lt;BR /&gt;else&lt;BR /&gt;   other_command&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;is equivalent to&lt;BR /&gt;[ $? -eq 0 ] &amp;amp;&amp;amp; command || other_command&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 04:21:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223625#M170799</guid>
      <dc:creator>Nicolas Dumeige</dc:creator>
      <dc:date>2004-03-19T04:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Script needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223626#M170800</link>
      <description>oops,&lt;BR /&gt;Sorry&lt;BR /&gt;$? is exit error code, and if it is 0 the command properly ENDED.&lt;BR /&gt;&lt;BR /&gt;Boris</description>
      <pubDate>Fri, 19 Mar 2004 04:25:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223626#M170800</guid>
      <dc:creator>Borislav Perkov</dc:creator>
      <dc:date>2004-03-19T04:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Script needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223627#M170801</link>
      <description>I would do this by using not the || but the &amp;amp;&amp;amp;...&lt;BR /&gt;&lt;BR /&gt;rcp -p /sdata/files/cptester/r1.txt a646001:/home/amartir/main_unix.txt &amp;amp;&amp;amp; \&lt;BR /&gt;mailx -s"Copy of Main_Unix to DSA" elit &amp;amp;&amp;amp; \&lt;BR /&gt;rm /sdata/files/cptester/r1.txt&lt;BR /&gt;&lt;BR /&gt;The same for the other command.&lt;BR /&gt;&lt;BR /&gt;Or the way mentioned above, using the return code in $? which is 0 (zero) for succesfull commands. You could even do it this way:&lt;BR /&gt;&lt;BR /&gt;if rcp ...&lt;BR /&gt;then&lt;BR /&gt;     mailx ...&lt;BR /&gt;     rm ...&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Mar 2004 05:27:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223627#M170801</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-03-19T05:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Script needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223628#M170802</link>
      <description>The simplest way is to use the "&amp;amp;&amp;amp;" operator which will only allow the things on the right of it to run if the thing on the left is succesful.&lt;BR /&gt; &lt;BR /&gt;rcp -p /sdata/files/cptester/r1.txt a646001:/home/amartir/main_unix.txt &amp;amp;&amp;amp; mycommand&lt;BR /&gt; &lt;BR /&gt;If "mycommand" needs to be several commands you can put them in braces as in &lt;BR /&gt; &lt;BR /&gt;rcp -p /sdata/files/cptester/r1.txt a646001:/home/amartir/main_unix.txt &amp;amp;&amp;amp; {&lt;BR /&gt; mailx .....&lt;BR /&gt; rm ....&lt;BR /&gt; etc ...&lt;BR /&gt;}&lt;BR /&gt; &lt;BR /&gt;The opposite of &amp;amp;&amp;amp; is ||</description>
      <pubDate>Fri, 19 Mar 2004 05:30:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223628#M170802</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-03-19T05:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help on Script needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223629#M170803</link>
      <description>Note that the remote shell and remote copy commands cannot be trusted for return code&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;HOST=a646001&lt;BR /&gt;rcp -p /sdata/files/cptester/r1.txt $HOST:/home/amartir/main_unix.txt&lt;BR /&gt;OK=`remsh $HOST ls /home/amartir/main_unix.txt | wc -l`&lt;BR /&gt;if [ "$OK" -eq 1 ]&lt;BR /&gt;then&lt;BR /&gt;   # ur commands&lt;BR /&gt;elif&lt;BR /&gt;   # ur commands&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;So try the above and make sure copy is done and use the number of files copied as input to ur if statement&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Mar 2004 01:24:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-on-script-needed/m-p/3223629#M170803</guid>
      <dc:creator>rvrameshbabu</dc:creator>
      <dc:date>2004-03-22T01:24:43Z</dc:date>
    </item>
  </channel>
</rss>

