<?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 diff return codes in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751726#M609696</link>
    <description>The man page for diff just says that errors return &amp;gt; 1.  Where can I find out what specific return codes from diff mean?</description>
    <pubDate>Fri, 11 Feb 2011 14:44:18 GMT</pubDate>
    <dc:creator>Ian Lochray</dc:creator>
    <dc:date>2011-02-11T14:44:18Z</dc:date>
    <item>
      <title>diff return codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751726#M609696</link>
      <description>The man page for diff just says that errors return &amp;gt; 1.  Where can I find out what specific return codes from diff mean?</description>
      <pubDate>Fri, 11 Feb 2011 14:44:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751726#M609696</guid>
      <dc:creator>Ian Lochray</dc:creator>
      <dc:date>2011-02-11T14:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: diff return codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751727#M609697</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;the SUN man pages tell (no HP at hand here)&lt;BR /&gt;0    No diffs&lt;BR /&gt;1    Diffs&lt;BR /&gt;&amp;gt;1   Error&lt;BR /&gt;&lt;BR /&gt;Many commands use '2' for ENOENT - errors 'no such file or directory'.&lt;BR /&gt;&lt;BR /&gt;For me the return values mentioned are succifient (Bourne-shell syntax):&lt;BR /&gt;case $? in&lt;BR /&gt;0) print same;;&lt;BR /&gt;1) print diff;;&lt;BR /&gt;*) pint error;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;BTW: I prefer 'cmp -s' for a testing of identical file content:&lt;BR /&gt;if cmp -s f1 f2; then print same;fi&lt;BR /&gt;&lt;BR /&gt;- 'cmp' quits after the first mismatch, which is good for large files&lt;BR /&gt;- In most cases I do not need a listing of the differences; cmp -s just sets return codes.&lt;BR /&gt;&lt;BR /&gt;mfG Peter&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Feb 2011 15:02:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751727#M609697</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2011-02-11T15:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: diff return codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751728#M609698</link>
      <description>I would like to know the return codes because the script I am using should take different action depending on why the diff fails e.g. if one of the files doesn't exist.  I realise that I could test this before or after the diff but that's just an extra step.</description>
      <pubDate>Fri, 11 Feb 2011 15:11:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751728#M609698</guid>
      <dc:creator>Ian Lochray</dc:creator>
      <dc:date>2011-02-11T15:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: diff return codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751729#M609699</link>
      <description>&lt;!--!*#--&gt;&amp;gt; [...] Where can I find out [...]&lt;BR /&gt;&lt;BR /&gt;Reliably, from the documents or the source&lt;BR /&gt;code.&lt;BR /&gt;&lt;BR /&gt;If the documents don't satisfy, and the&lt;BR /&gt;source code is unavailable, then you're left&lt;BR /&gt;with experiment.  How many different return&lt;BR /&gt;status values have you seen?  Knowing&lt;BR /&gt;nothing, I have no reason to believe that&lt;BR /&gt;"diff" returns interesting values greater&lt;BR /&gt;than one.&lt;BR /&gt;&lt;BR /&gt;Source for GNU "diff" _is_ readily available.&lt;BR /&gt;&lt;BR /&gt;One of the many problems with relying on&lt;BR /&gt;experiment rather than the documents is that&lt;BR /&gt;whatever you discover could become obsolete&lt;BR /&gt;at the next "diff" update.  Or when you move&lt;BR /&gt;to another system, where "diff" is different.</description>
      <pubDate>Fri, 11 Feb 2011 15:23:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751729#M609699</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-02-11T15:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: diff return codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751730#M609700</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;as Steven told you - don't expect to much from retern values &amp;gt;1.&lt;BR /&gt;You can start a test series, giving diff non-existing or unreadable file(s) as 1st and/or 2nd argument, but I don't think you get something different as '2'.&lt;BR /&gt;&lt;BR /&gt;I think, you should be able to do this by yourself:&lt;BR /&gt;&lt;BR /&gt;diff file1 file2&lt;BR /&gt;case $? in&lt;BR /&gt;0) print same;;&lt;BR /&gt;1) print diff;;&lt;BR /&gt;*)&lt;BR /&gt;  [ -e file1 ] || print -u2 missing file1&lt;BR /&gt;  [ -d file1 ] &amp;amp;&amp;amp; print -u2 a dir: file1&lt;BR /&gt;  ...&lt;BR /&gt;;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;mfG Peter&lt;BR /&gt;&lt;BR /&gt;PS: 1 point received - whow!!</description>
      <pubDate>Fri, 11 Feb 2011 15:51:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751730#M609700</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2011-02-11T15:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: diff return codes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751731#M609701</link>
      <description>&lt;!--!*#--&gt;&amp;gt; PS: 1 point received - whow!!&lt;BR /&gt;&lt;BR /&gt;Points awards in these forums often reveal&lt;BR /&gt;more about the questioner than about the&lt;BR /&gt;quality of the responses.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Source for GNU "diff" [...]&lt;BR /&gt;&lt;BR /&gt;A quick look suggests that it uses&lt;BR /&gt;EXIT_SUCCESS (0), EXIT_FAILURE (1), and&lt;BR /&gt;EXIT_TROUBLE (2), but there could be more in&lt;BR /&gt;there that I didn't notice.  Code like:&lt;BR /&gt;&lt;BR /&gt;[...]&lt;BR /&gt;            int status = compare_files (NULL, from_file, argv[optind]);&lt;BR /&gt;            if (exit_status &amp;lt; status)&lt;BR /&gt;              exit_status = status;&lt;BR /&gt;[...]&lt;BR /&gt;&lt;BR /&gt;suggests that bigger values imply bigger&lt;BR /&gt;problems.  (But, if such stuff isn't&lt;BR /&gt;documented, then what good is it?)</description>
      <pubDate>Fri, 11 Feb 2011 17:14:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/diff-return-codes/m-p/4751731#M609701</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2011-02-11T17:14:49Z</dc:date>
    </item>
  </channel>
</rss>

