<?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: find return code ??? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/find-return-code/m-p/3106882#M148034</link>
    <description>If you mean by return code trhe value of ${?} then find's value is not going to help very much. Assuming you have no syntax errors, it's pretty much always going to be zero whether anything is found or not BUT because this is part of a pipeline it's really awk's value that you will see rather than find's.&lt;BR /&gt;&lt;BR /&gt;Another approach might be to do this:&lt;BR /&gt;typeset -L7 USER&lt;BR /&gt;typeset -i10 SZ&lt;BR /&gt;typeset FNAME&lt;BR /&gt;find ${file} -type f -size +${FINDSZ}c -exec ll {} \; | awk '{printf("%7s %9d %-35s\n",$3,$5,$9)}' | while read USER SZ FNAME&lt;BR /&gt;do&lt;BR /&gt;  echo "User = ${USER} SIZE = ${SZ} File = ${FNAME}"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Note that now you don't need a temp file.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 30 Oct 2003 15:18:50 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2003-10-30T15:18:50Z</dc:date>
    <item>
      <title>find return code ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-return-code/m-p/3106880#M148032</link>
      <description>I am using find to check if a file is greater than a specific size, and if it is executing ll to pull off some information:&lt;BR /&gt;&lt;BR /&gt;find ${file} -size +${FINDSZ}c -exec ll {} \; | awk '{printf("%7s %9d %-35s\n",$3,$5,$9)}' &amp;gt;&amp;gt; ${FIND}&lt;BR /&gt;&lt;BR /&gt;Based on if it was greater than the size I was looking for will determine what I need to do next in the script, but I'm not sure how to determine this in the script???&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Oct 2003 14:40:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-return-code/m-p/3106880#M148032</guid>
      <dc:creator>MikeL_4</dc:creator>
      <dc:date>2003-10-30T14:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: find return code ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-return-code/m-p/3106881#M148033</link>
      <description>using $? you always get the return code of the last command executed. in your case that would be awk. by using the pipe you've lost the return code to the find command.&lt;BR /&gt;&lt;BR /&gt;but, if the file your writing to is zero in size before the find and larger then zero afterwards, the find command found some files.&lt;BR /&gt;&lt;BR /&gt;rm $FIND&lt;BR /&gt;find ${file} -size +${FINDSZ}c -exec ll {} \; | awk '{printf("%7s %9d %-35s\n",$3,$5,$9)}' &amp;gt;&amp;gt; ${FIND}&lt;BR /&gt;if [[ -f $FIND ]] ;then&lt;BR /&gt;print "$FIND is created, find found something"&lt;BR /&gt;fi&lt;BR /&gt;if [[ -s $FIND ]] ;then&lt;BR /&gt;print "$FIND exists and is larger then zero"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;and your script will run faster if you use xargs</description>
      <pubDate>Thu, 30 Oct 2003 15:13:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-return-code/m-p/3106881#M148033</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-10-30T15:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: find return code ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-return-code/m-p/3106882#M148034</link>
      <description>If you mean by return code trhe value of ${?} then find's value is not going to help very much. Assuming you have no syntax errors, it's pretty much always going to be zero whether anything is found or not BUT because this is part of a pipeline it's really awk's value that you will see rather than find's.&lt;BR /&gt;&lt;BR /&gt;Another approach might be to do this:&lt;BR /&gt;typeset -L7 USER&lt;BR /&gt;typeset -i10 SZ&lt;BR /&gt;typeset FNAME&lt;BR /&gt;find ${file} -type f -size +${FINDSZ}c -exec ll {} \; | awk '{printf("%7s %9d %-35s\n",$3,$5,$9)}' | while read USER SZ FNAME&lt;BR /&gt;do&lt;BR /&gt;  echo "User = ${USER} SIZE = ${SZ} File = ${FNAME}"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Note that now you don't need a temp file.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Oct 2003 15:18:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-return-code/m-p/3106882#M148034</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-10-30T15:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: find return code ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-return-code/m-p/3106883#M148035</link>
      <description>First, when piping commands together, $? will always be the value returned from the last (ie the leftmost) command.&lt;BR /&gt;&lt;BR /&gt;Hoever, unless I've misunderstood, it doesn't look like you need find at all.&lt;BR /&gt;&lt;BR /&gt;Find will find all files from a given directory, but if you know the file name, you can get its size from any of "ls -l", "wc -c", "cksum".&lt;BR /&gt;&lt;BR /&gt;eg&lt;BR /&gt;SIZE=$(ls -l ${f} |awk '{print $5}')&lt;BR /&gt;if [ $"SIZE -gt YOURMAX ]&lt;BR /&gt;then&lt;BR /&gt;    YOUR CODE HERE to do something with ${f}&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;If you do need to use find, then enclose the processing within a loop. &lt;BR /&gt;You don't need to do any other testing, as you know that find will only return the files you want.&lt;BR /&gt;&lt;BR /&gt;for f in $(find ${file} -size +${FINDSZ}c )&lt;BR /&gt;do&lt;BR /&gt;    YOUR CODE HERE to do something with ${f}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Fri, 31 Oct 2003 05:38:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-return-code/m-p/3106883#M148035</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-31T05:38:06Z</dc:date>
    </item>
  </channel>
</rss>

