<?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: trap process id in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560124#M918271</link>
    <description>Thanks to both of you guys &lt;BR /&gt;I'm now a happy camper :-)&lt;BR /&gt;</description>
    <pubDate>Wed, 01 Aug 2001 17:37:32 GMT</pubDate>
    <dc:creator>Dominic Ouellet</dc:creator>
    <dc:date>2001-08-01T17:37:32Z</dc:date>
    <item>
      <title>trap process id</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560120#M918267</link>
      <description>I everybody,&lt;BR /&gt;&lt;BR /&gt;Here is the situation. I need to recover the PID of a program I launched in background (from a script). Other scripts may have launched the same program so a simple ps | grep command wouldn't do the job. I feel unsure with the $! command (witch return the PID of the last background program that has been launched) because two script could launch background programs at the same time and then, I can't be sure I got the PID of my program. I also heard about the ps -H but it only applies for XPG4. Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks for your help...&lt;BR /&gt;Dom</description>
      <pubDate>Wed, 01 Aug 2001 16:34:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560120#M918267</guid>
      <dc:creator>Dominic Ouellet</dc:creator>
      <dc:date>2001-08-01T16:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: trap process id</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560121#M918268</link>
      <description>Dom,&lt;BR /&gt;   I think the $! is the best way to go.  You should be ok because $! is local to the shell you are in so it should not know the PID of a background process started in another shell.  &lt;BR /&gt;&lt;BR /&gt;Rusty</description>
      <pubDate>Wed, 01 Aug 2001 16:53:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560121#M918268</guid>
      <dc:creator>Dan Bonham</dc:creator>
      <dc:date>2001-08-01T16:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: trap process id</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560122#M918269</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;While pid values will eventually be reused (when they are no longer in use), there is no problem with capturing a pid in a variable and later referencing/testing it.&lt;BR /&gt;&lt;BR /&gt;See this recent thread for some examples:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xfe7387dc4d7dd5118ff00090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xfe7387dc4d7dd5118ff00090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;ALSO: if you want to leverage the UNIX95 options of 'ps' all you need do is arm the UNIX95 variable for the duration of the 'ps' like this (your offering):&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -H&lt;BR /&gt;&lt;BR /&gt;Note the blank character after the equal sign and the absence of any semicolon!  This syntax sets UNIX95 only for the command on the line it is written.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 01 Aug 2001 16:55:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560122#M918269</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-08-01T16:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: trap process id</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560123#M918270</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;It doesn't matter if another process also spawns a process of the same name. $! will definitely be the pid of the last background child process spawned by this shell.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Wed, 01 Aug 2001 17:02:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560123#M918270</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-08-01T17:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: trap process id</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560124#M918271</link>
      <description>Thanks to both of you guys &lt;BR /&gt;I'm now a happy camper :-)&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Aug 2001 17:37:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trap-process-id/m-p/2560124#M918271</guid>
      <dc:creator>Dominic Ouellet</dc:creator>
      <dc:date>2001-08-01T17:37:32Z</dc:date>
    </item>
  </channel>
</rss>

