<?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 me complete this script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314605#M186286</link>
    <description>You can really take advantage of this feature of diff. It returns 0 if there are no differences, 1 if there are differences, and &amp;gt; 1 on error. Note: We are not concerned about the output (stdout or stderr) of diff but rather the result returned to the shell.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This should make a reasonable test for you:&lt;BR /&gt;&lt;BR /&gt;diff file1 file2 &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "Files the same"&lt;BR /&gt;else&lt;BR /&gt;  echo "They ain't"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;You could also use the output of the cksum command for each file and compare them.&lt;BR /&gt;</description>
    <pubDate>Thu, 24 Jun 2004 11:37:13 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2004-06-24T11:37:13Z</dc:date>
    <item>
      <title>Help me complete this script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314603#M186284</link>
      <description>I need a test statement for a script.  I have a file that I copy to an archive location.  To ensure it's finished being created in it's original location I want to compare the original to the copy after 15 minutes and see if they are the same.  &lt;BR /&gt;&lt;BR /&gt;cp STOCK_FILE /var/STOCK_ARCHIVE/STOCK_FILE&lt;BR /&gt;&lt;BR /&gt;sleep 900&lt;BR /&gt;&lt;BR /&gt;until [ diff STOCK_FILE /var/STOCK_ARCHIVE/STOCK_FILE =0 ]&lt;BR /&gt;cp STOCK_FILE /var/STOCK_ARCHIVE/STOCK_FILE&lt;BR /&gt;sleep 300&lt;BR /&gt;&lt;BR /&gt;I don't know how to do the test statement so that it checks that the diff comparison returns no difference.  If there is a difference then the original file should overwrite the copy, wait 5 minutes and then try again to see if the file is done.</description>
      <pubDate>Thu, 24 Jun 2004 11:15:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314603#M186284</guid>
      <dc:creator>Terrence</dc:creator>
      <dc:date>2004-06-24T11:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help me complete this script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314604#M186285</link>
      <description>size_of_source=`ll file|awk '{print $5}`&lt;BR /&gt;size_of_desti=` ll \dest\file|awk '{print $5}`&lt;BR /&gt;&lt;BR /&gt;if [ ${size_of_source} -eq ${size_of_desti} ];then&lt;BR /&gt;echo "File  copy OK"&lt;BR /&gt;exit 0&lt;BR /&gt;else&lt;BR /&gt;sleep sometime&lt;BR /&gt;cp source_file dest_file&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Thu, 24 Jun 2004 11:28:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314604#M186285</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-06-24T11:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help me complete this script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314605#M186286</link>
      <description>You can really take advantage of this feature of diff. It returns 0 if there are no differences, 1 if there are differences, and &amp;gt; 1 on error. Note: We are not concerned about the output (stdout or stderr) of diff but rather the result returned to the shell.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This should make a reasonable test for you:&lt;BR /&gt;&lt;BR /&gt;diff file1 file2 &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;STAT=${?}&lt;BR /&gt;if [[ ${STAT} -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "Files the same"&lt;BR /&gt;else&lt;BR /&gt;  echo "They ain't"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;You could also use the output of the cksum command for each file and compare them.&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Jun 2004 11:37:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314605#M186286</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-06-24T11:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help me complete this script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314606#M186287</link>
      <description>cp will come out only after finishing the copy and if there are any errors occured you can trap it by checking $? (return-code).&lt;BR /&gt;&lt;BR /&gt;cp bla /archiv/bla&lt;BR /&gt;if [ $? -ne 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo Copy failed ...&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Thu, 24 Jun 2004 12:01:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314606#M186287</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2004-06-24T12:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help me complete this script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314607#M186288</link>
      <description>until cmp -s STOCL_FILE /var/STOCK_ARCHIVE/STOCK_FILE&lt;BR /&gt;do&lt;BR /&gt;  cp ....&lt;BR /&gt;  sleep ...&lt;BR /&gt;done</description>
      <pubDate>Thu, 24 Jun 2004 13:11:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314607#M186288</guid>
      <dc:creator>Dan Martin_1</dc:creator>
      <dc:date>2004-06-24T13:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help me complete this script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314608#M186289</link>
      <description>Thank you Dan,&lt;BR /&gt;&lt;BR /&gt;While the other two answers were usable, I wasn't looking for if statements, I needed it to loop until they matched hence the use of until.&lt;BR /&gt;&lt;BR /&gt;Also Dan's answer was exactly what I needed and only required the one line.  Simplicity is always preferable.&lt;BR /&gt;&lt;BR /&gt;Thanks to all who answered.</description>
      <pubDate>Thu, 24 Jun 2004 13:35:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-me-complete-this-script/m-p/3314608#M186289</guid>
      <dc:creator>Terrence</dc:creator>
      <dc:date>2004-06-24T13:35:42Z</dc:date>
    </item>
  </channel>
</rss>

