<?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 Generated or received a file descriptor number that is not valid in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5396699#M639788</link>
    <description>&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;I'm running a shell script that is calling another one.&lt;/P&gt;&lt;P&gt;So it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;runer.sh&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;exec 4&amp;lt;&amp;amp;0&lt;BR /&gt;while read Filer User Password Sysdba; do&lt;BR /&gt;case $Filer in&lt;BR /&gt;*.sh)&lt;BR /&gt;exec 5&amp;lt;&amp;amp;0&lt;BR /&gt;exec 0&amp;lt;&amp;amp;4&lt;BR /&gt;.$Filer&lt;BR /&gt;if test $? -ne 0;&lt;BR /&gt;then echo ERROR: .$Filer encountered an error ` 2&amp;gt;&amp;amp;1 | tee -a $LOG_DIRECTORY&lt;BR /&gt;echo 2&amp;gt;&amp;amp;1 | tee -a $LOG_DIRECTORY&lt;BR /&gt;fi;&lt;BR /&gt;exec 0&amp;lt;&amp;amp;5;;&lt;BR /&gt;;;&lt;BR /&gt;esac&lt;BR /&gt;done &amp;lt; `basename $list_file`;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;FileinFiler.sh&lt;/STRONG&gt;&lt;BR /&gt;echo 'Do you really wish to remove the user (y/n)?' 2&amp;gt;&amp;amp;1 | tee -a $LOG_DIRECTORY&lt;BR /&gt;exec 5&amp;lt;&amp;amp;0&lt;BR /&gt;exec 0&amp;lt;&amp;amp;4&lt;BR /&gt;read continue&lt;BR /&gt;exec 0&amp;lt;&amp;amp;5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So line 3 in &lt;STRONG&gt;FileinFiler.sh&lt;/STRONG&gt;&amp;nbsp;(&lt;EM&gt;exec 0&amp;lt;&amp;amp;4&lt;/EM&gt;) is causing the above error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this in Linux with LSOF I see that the file descriptor is recognized.&lt;/P&gt;&lt;P&gt;So I guees that in HP-UX, the filedescriptor 4 has been lost for the switch of content when calling the second shell (I do not know how to install LSFOF in HP-UX...looking for that info now).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is: how do I fix this one? I think the intent here is to get the value of the answer in the continue variable and write it to a file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Nov 2011 20:56:25 GMT</pubDate>
    <dc:creator>jfr1</dc:creator>
    <dc:date>2011-11-21T20:56:25Z</dc:date>
    <item>
      <title>Generated or received a file descriptor number that is not valid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5396699#M639788</link>
      <description>&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;I'm running a shell script that is calling another one.&lt;/P&gt;&lt;P&gt;So it looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;runer.sh&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;exec 4&amp;lt;&amp;amp;0&lt;BR /&gt;while read Filer User Password Sysdba; do&lt;BR /&gt;case $Filer in&lt;BR /&gt;*.sh)&lt;BR /&gt;exec 5&amp;lt;&amp;amp;0&lt;BR /&gt;exec 0&amp;lt;&amp;amp;4&lt;BR /&gt;.$Filer&lt;BR /&gt;if test $? -ne 0;&lt;BR /&gt;then echo ERROR: .$Filer encountered an error ` 2&amp;gt;&amp;amp;1 | tee -a $LOG_DIRECTORY&lt;BR /&gt;echo 2&amp;gt;&amp;amp;1 | tee -a $LOG_DIRECTORY&lt;BR /&gt;fi;&lt;BR /&gt;exec 0&amp;lt;&amp;amp;5;;&lt;BR /&gt;;;&lt;BR /&gt;esac&lt;BR /&gt;done &amp;lt; `basename $list_file`;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;FileinFiler.sh&lt;/STRONG&gt;&lt;BR /&gt;echo 'Do you really wish to remove the user (y/n)?' 2&amp;gt;&amp;amp;1 | tee -a $LOG_DIRECTORY&lt;BR /&gt;exec 5&amp;lt;&amp;amp;0&lt;BR /&gt;exec 0&amp;lt;&amp;amp;4&lt;BR /&gt;read continue&lt;BR /&gt;exec 0&amp;lt;&amp;amp;5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So line 3 in &lt;STRONG&gt;FileinFiler.sh&lt;/STRONG&gt;&amp;nbsp;(&lt;EM&gt;exec 0&amp;lt;&amp;amp;4&lt;/EM&gt;) is causing the above error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this in Linux with LSOF I see that the file descriptor is recognized.&lt;/P&gt;&lt;P&gt;So I guees that in HP-UX, the filedescriptor 4 has been lost for the switch of content when calling the second shell (I do not know how to install LSFOF in HP-UX...looking for that info now).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is: how do I fix this one? I think the intent here is to get the value of the answer in the continue variable and write it to a file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2011 20:56:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5396699#M639788</guid>
      <dc:creator>jfr1</dc:creator>
      <dc:date>2011-11-21T20:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Generated or received a file descriptor number that is not valid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5396711#M639789</link>
      <description>&lt;P&gt;&amp;gt;.$Filer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a space after the period?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;echo ERROR: .$Filer encountered an error ` 2&amp;gt;&amp;amp;1 | tee -a $LOG_DIRECTORY&lt;BR /&gt;&amp;gt;echo 2&amp;gt;&amp;amp;1 | tee -a $LOG_DIRECTORY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That (`) is unbalanced.&amp;nbsp; Also you don't need to use "2&amp;gt;&amp;amp;1" here.&amp;nbsp; And you might as well combine the two echoes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo "ERROR: .$Filer encountered an error\n" | tee -a $LOG_DIRECTORY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;echo 'Do you really wish to remove the user (y/n)?' 2&amp;gt;&amp;amp;1 | tee -a $LOG_DIRECTORY&lt;BR /&gt;exec 5&amp;lt;&amp;amp;0&lt;BR /&gt;exec 0&amp;lt;&amp;amp;4&lt;BR /&gt;read continue&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Why bother with this exec fiddling if this is already done in runer.sh before&amp;nbsp;FileinFiler.sh is called?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;I guess that in HP-UX, the filedescriptor 4 has been lost for the switch of content when calling the second shell (I do not know how to install lsof in HP-UX.).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You want tusc instead to trace the system calls.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2011 21:22:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5396711#M639789</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-11-21T21:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Generated or received a file descriptor number that is not valid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5396743#M639790</link>
      <description>&lt;P&gt;Yes the unbalanced ' was a copy and paste mistake.&lt;/P&gt;&lt;P&gt;No space before the period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the intent was to grab th response and add it to the log file somehow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your suggestions are fine, but they do not cause the error that I'm experiencing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure what tusc is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2011 21:37:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5396743#M639790</guid>
      <dc:creator>jfr1</dc:creator>
      <dc:date>2011-11-21T21:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Generated or received a file descriptor number that is not valid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5396823#M639791</link>
      <description>&lt;P&gt;&amp;gt;No space before the period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was asking about after.&amp;nbsp; If you source that script, it doesn't have that FD error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;Not sure what tusc is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said, this is the tool you need.&amp;nbsp; It traces system calls.&lt;/P&gt;&lt;P&gt;&lt;A href="http://hpux.connect.org.uk/hppd/hpux/Sysadmin/tusc-8.1/" target="_blank"&gt;http://hpux.connect.org.uk/hppd/hpux/Sysadmin/tusc-8.1/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tusc shows that a real shell doing I/O redirection with exec command, calls: fcntl(FD, F_SETFD, FD_CLOEXEC)&lt;/P&gt;&lt;P&gt;This doesn't happen if you source the script.&lt;/P&gt;&lt;P&gt;But since the file you source redoes the redirection, FD 5 is destroyed in the first script.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 06:27:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5396823#M639791</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-11-22T06:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Generated or received a file descriptor number that is not valid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5397545#M639792</link>
      <description>&lt;P&gt;Thanks for your quick answers...but I do not think I follow you with the source thing.&lt;/P&gt;&lt;P&gt;My experience with HP-UX is a total of about 2 days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 14:56:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5397545#M639792</guid>
      <dc:creator>jfr1</dc:creator>
      <dc:date>2011-11-22T14:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Generated or received a file descriptor number that is not valid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5397827#M639793</link>
      <description>&lt;P&gt;&amp;gt;but I do not think I follow you with the source thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have a space after that period?&amp;nbsp; That's called sourcing in a real shell.&lt;/P&gt;&lt;P&gt;When you source a script, you don't do an exec, so the redirected files remain open.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then you'll need to remove the exec(s) in the FileinFiler.sh.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 21:40:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/generated-or-received-a-file-descriptor-number-that-is-not-valid/m-p/5397827#M639793</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-11-22T21:40:41Z</dc:date>
    </item>
  </channel>
</rss>

