<?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 Process names in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638076#M42873</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;Can anyone help?  &lt;BR /&gt;&lt;BR /&gt;I need to enable a script (call it Script2) to find out the Name of the calling script (eg Script1). &lt;BR /&gt;&lt;BR /&gt;I have an idea that the pid or ppid should help but do not know exactly how.&lt;BR /&gt;&lt;BR /&gt;Any suggestions would be welcomed.&lt;BR /&gt;&lt;BR /&gt;Greg Hitchcock</description>
    <pubDate>Thu, 03 Jan 2002 10:41:31 GMT</pubDate>
    <dc:creator>Greg Hitchcock</dc:creator>
    <dc:date>2002-01-03T10:41:31Z</dc:date>
    <item>
      <title>Process names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638076#M42873</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Can anyone help?  &lt;BR /&gt;&lt;BR /&gt;I need to enable a script (call it Script2) to find out the Name of the calling script (eg Script1). &lt;BR /&gt;&lt;BR /&gt;I have an idea that the pid or ppid should help but do not know exactly how.&lt;BR /&gt;&lt;BR /&gt;Any suggestions would be welcomed.&lt;BR /&gt;&lt;BR /&gt;Greg Hitchcock</description>
      <pubDate>Thu, 03 Jan 2002 10:41:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638076#M42873</guid>
      <dc:creator>Greg Hitchcock</dc:creator>
      <dc:date>2002-01-03T10:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Process names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638077#M42874</link>
      <description>Hi Greg,&lt;BR /&gt;&lt;BR /&gt;How about:&lt;BR /&gt;&lt;BR /&gt;ps -fp $$ | tail -1 | awk '{print $3}' | read PPID&lt;BR /&gt;ps -p $PPID | tail -1 | awk '{print $4}'&lt;BR /&gt;&lt;BR /&gt;For a ksh, you don't need the 1st line, since there is a PPID variable created automatically, containing the parent process id.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Thu, 03 Jan 2002 10:56:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638077#M42874</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-01-03T10:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Process names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638078#M42875</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Korn/Posix shells will have the variable ${PPID} set to the parent process.&lt;BR /&gt;&lt;BR /&gt;Given that, you can use ps to find the command and arguments of the parent process. Using the UNIX95 options of ps make it easier so to get the parent's command for instance:-&lt;BR /&gt;&lt;BR /&gt;COMM=$(UNIX95= ps -p ${PPID} -o comm |tail -1)&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
      <pubDate>Thu, 03 Jan 2002 10:57:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638078#M42875</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2002-01-03T10:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Process names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638079#M42876</link>
      <description>Generally, it will be difficult to do so.&lt;BR /&gt;&lt;BR /&gt;If there is a shell script script1 and you execute the script, the output of "ps -f" will give process name as "-ksh" or "sh", and not as "script1" as expected. So you can get the parent process-id, but in many cases it will be difficult to get the process name.&lt;BR /&gt;&lt;BR /&gt;If the script "script1" is executed as "/bin/sh script1" (or similarly ksh or csh etc.) then "ps -f" will show the script name in last column. Then you can either use PPID variable or "$$" to get parent process-id and it's name.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 03 Jan 2002 11:26:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638079#M42876</guid>
      <dc:creator>Suhas_3</dc:creator>
      <dc:date>2002-01-03T11:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Process names</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638080#M42877</link>
      <description>Hello Greg,&lt;BR /&gt;&lt;BR /&gt;how about a one-liner:&lt;BR /&gt;&lt;BR /&gt;parent=$(UNIX95= ps -o comm -p $PPID)&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch</description>
      <pubDate>Thu, 03 Jan 2002 19:33:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-names/m-p/2638080#M42877</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2002-01-03T19:33:19Z</dc:date>
    </item>
  </channel>
</rss>

