<?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: could not able to get right exit value from perl script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/could-not-able-to-get-right-exit-value-from-perl-script/m-p/4366547#M684391</link>
    <description>You might read the docs:&lt;BR /&gt;&lt;BR /&gt;$ perldoc -f system&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://perldoc.perl.org/functions/system.html" target="_blank"&gt;http://perldoc.perl.org/functions/system.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;where it says, &lt;BR /&gt;&lt;BR /&gt;"The return value is the exit status of the program as returned by the wait call. To get the actual exit value, shift right by eight."&lt;BR /&gt;&lt;BR /&gt;So, if you shift the result right by 8, you get what you are looking for:&lt;BR /&gt;&lt;BR /&gt;$ perl -e "$x=system('perl -e exit(123)'); print $x"&lt;BR /&gt;31488&lt;BR /&gt;$ perl -e "$x=system('perl -e exit(123)'); print $x &amp;gt;&amp;gt; 8;"&lt;BR /&gt;123&lt;BR /&gt;&lt;BR /&gt;If you were using Perl on VMS (which you appear not to be) you could use the vmsish 'exit' pragma to control whether you get native exit codes or POSIX emulation.</description>
    <pubDate>Wed, 25 Feb 2009 20:12:24 GMT</pubDate>
    <dc:creator>Craig A Berry</dc:creator>
    <dc:date>2009-02-25T20:12:24Z</dc:date>
    <item>
      <title>could not able to get right exit value from perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/could-not-able-to-get-right-exit-value-from-perl-script/m-p/4366545#M684389</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Please check below perl &amp;amp; shell script.&lt;BR /&gt;&lt;BR /&gt;root@ &amp;gt; more test.pl&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;print " begining of programme \n";&lt;BR /&gt;&lt;BR /&gt;$val=1;&lt;BR /&gt;$val=system("sh check.sh");&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;print "Exit Value : ",$?,"\n";&lt;BR /&gt;print "Value of veriable val : ",$val,"\n";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;root@ &amp;gt; more check.sh&lt;BR /&gt;&lt;BR /&gt;echo "Inside Shell Script..... check.sh......";&lt;BR /&gt;exit 123;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;unixh147-root@ /home/gm433 &amp;gt; perl test.pl&lt;BR /&gt;&lt;BR /&gt;begining of programme&lt;BR /&gt;&lt;BR /&gt;Exit Value: 31488&lt;BR /&gt;&lt;BR /&gt;Value of veriable val : 31488&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Why I am not able to get correct value i.e. 123 ?&lt;BR /&gt;&lt;BR /&gt;How can I get value 123?&lt;BR /&gt;&lt;BR /&gt;Please help me.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Goutam&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Feb 2009 18:18:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/could-not-able-to-get-right-exit-value-from-perl-script/m-p/4366545#M684389</guid>
      <dc:creator>Goutam Maity</dc:creator>
      <dc:date>2009-02-25T18:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: could not able to get right exit value from perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/could-not-able-to-get-right-exit-value-from-perl-script/m-p/4366546#M684390</link>
      <description>You might get better answers sooner in a&lt;BR /&gt;forum related to your actual OS, which does&lt;BR /&gt;not appear to be VMS.</description>
      <pubDate>Wed, 25 Feb 2009 19:13:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/could-not-able-to-get-right-exit-value-from-perl-script/m-p/4366546#M684390</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-02-25T19:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: could not able to get right exit value from perl script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/could-not-able-to-get-right-exit-value-from-perl-script/m-p/4366547#M684391</link>
      <description>You might read the docs:&lt;BR /&gt;&lt;BR /&gt;$ perldoc -f system&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://perldoc.perl.org/functions/system.html" target="_blank"&gt;http://perldoc.perl.org/functions/system.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;where it says, &lt;BR /&gt;&lt;BR /&gt;"The return value is the exit status of the program as returned by the wait call. To get the actual exit value, shift right by eight."&lt;BR /&gt;&lt;BR /&gt;So, if you shift the result right by 8, you get what you are looking for:&lt;BR /&gt;&lt;BR /&gt;$ perl -e "$x=system('perl -e exit(123)'); print $x"&lt;BR /&gt;31488&lt;BR /&gt;$ perl -e "$x=system('perl -e exit(123)'); print $x &amp;gt;&amp;gt; 8;"&lt;BR /&gt;123&lt;BR /&gt;&lt;BR /&gt;If you were using Perl on VMS (which you appear not to be) you could use the vmsish 'exit' pragma to control whether you get native exit codes or POSIX emulation.</description>
      <pubDate>Wed, 25 Feb 2009 20:12:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/could-not-able-to-get-right-exit-value-from-perl-script/m-p/4366547#M684391</guid>
      <dc:creator>Craig A Berry</dc:creator>
      <dc:date>2009-02-25T20:12:24Z</dc:date>
    </item>
  </channel>
</rss>

