<?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: pass the return status of perl script to shell script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187923#M91230</link>
    <description>&lt;!--!*#--&gt;&amp;gt;Peter: you could drop the ';' at the end of the 'if' condition&lt;BR /&gt;&lt;BR /&gt;Better yet, keep it and do:&lt;BR /&gt;if ... ; then&lt;BR /&gt;&lt;BR /&gt;&amp;gt;you could pass $? to the calling environment of the shell script&lt;BR /&gt;&lt;BR /&gt;I'm not sure this will work.  The print will destroy $?.&lt;BR /&gt;&lt;BR /&gt;my-perl-script.pl arg1 arg1&lt;BR /&gt;result=$?&lt;BR /&gt;if [ $result -eq 0]; then # further processing&lt;BR /&gt;   print OK&lt;BR /&gt;else&lt;BR /&gt;   print -u2 ERROR in xxx&lt;BR /&gt;   exit $result&lt;BR /&gt;fi</description>
    <pubDate>Tue, 29 Apr 2008 09:11:09 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-04-29T09:11:09Z</dc:date>
    <item>
      <title>pass the return status of perl script to shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187918#M91225</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am calling a perl script to ftp files from one server to another server and I want the exit status of the perl script to be passed to the calling shell script so tht I can send success or failure mail from shell script</description>
      <pubDate>Mon, 28 Apr 2008 13:18:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187918#M91225</guid>
      <dc:creator>chinnaga</dc:creator>
      <dc:date>2008-04-28T13:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: pass the return status of perl script to shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187919#M91226</link>
      <description>Not a perl expert but typically the end of a script would be completed by exit 1 (or some non zero )for a failure.  You can then use the exit code with $? for error detection in the parent.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Apr 2008 13:49:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187919#M91226</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2008-04-28T13:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: pass the return status of perl script to shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187920#M91227</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;As with any process, exit with the value you wish to propagate to the caller.&lt;BR /&gt;&lt;BR /&gt;In this case, your Perl script "knows" the status of the FTP action.  For example:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;$ftp-&amp;gt;login() or die "Can't login!";&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;In this case, the 'die' causes the Perl script to exit with a non-zero return status.&lt;BR /&gt;&lt;BR /&gt;If you want to handle other conditions and exit later, set a variable with some return code and simple 'exit($lastaction)'.&lt;BR /&gt;&lt;BR /&gt;In any case, your shell wrapper can then test the '$?' variable for the result of the Perl script just like any command's return status.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Apr 2008 13:58:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187920#M91227</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-04-28T13:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: pass the return status of perl script to shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187921#M91228</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;besides checking the variable $?, you can directly use something like the following in your shell script, when no further handling of the exit-status is required:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;...&lt;BR /&gt;if my-perl-script.pl arg1 arg1;&lt;BR /&gt;then # further processing&lt;BR /&gt;   print OK&lt;BR /&gt;else&lt;BR /&gt;  print -u2 ERROR in xxx&lt;BR /&gt;  exit 1&lt;BR /&gt;fi&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 28 Apr 2008 15:51:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187921#M91228</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2008-04-28T15:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: pass the return status of perl script to shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187922#M91229</link>
      <description>Hi,&lt;BR /&gt;small additions:&lt;BR /&gt;- you could drop the ';' at the end of the 'if' condition&lt;BR /&gt;- you could pass $? to the calling environment of the shell script&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;...&lt;BR /&gt;if my-perl-script.pl arg1 arg1&lt;BR /&gt;then # further processing&lt;BR /&gt;print OK&lt;BR /&gt;else&lt;BR /&gt;print -u2 ERROR in xxx&lt;BR /&gt;exit $?&lt;BR /&gt;fi&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 28 Apr 2008 15:57:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187922#M91229</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2008-04-28T15:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: pass the return status of perl script to shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187923#M91230</link>
      <description>&lt;!--!*#--&gt;&amp;gt;Peter: you could drop the ';' at the end of the 'if' condition&lt;BR /&gt;&lt;BR /&gt;Better yet, keep it and do:&lt;BR /&gt;if ... ; then&lt;BR /&gt;&lt;BR /&gt;&amp;gt;you could pass $? to the calling environment of the shell script&lt;BR /&gt;&lt;BR /&gt;I'm not sure this will work.  The print will destroy $?.&lt;BR /&gt;&lt;BR /&gt;my-perl-script.pl arg1 arg1&lt;BR /&gt;result=$?&lt;BR /&gt;if [ $result -eq 0]; then # further processing&lt;BR /&gt;   print OK&lt;BR /&gt;else&lt;BR /&gt;   print -u2 ERROR in xxx&lt;BR /&gt;   exit $result&lt;BR /&gt;fi</description>
      <pubDate>Tue, 29 Apr 2008 09:11:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187923#M91230</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-29T09:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: pass the return status of perl script to shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187924#M91231</link>
      <description>Thanks a lot , it worked.</description>
      <pubDate>Tue, 29 Apr 2008 09:18:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187924#M91231</guid>
      <dc:creator>chinnaga</dc:creator>
      <dc:date>2008-04-29T09:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: pass the return status of perl script to shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187925#M91232</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Dennis is right - either print or pass the exit status:&lt;BR /&gt;&lt;BR /&gt;EITHET THIS:&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;...&lt;BR /&gt;if my-perl-script.pl arg1 arg1&lt;BR /&gt;then # further processing&lt;BR /&gt;print OK&lt;BR /&gt;else&lt;BR /&gt;print -u2 ERROR $? in xxx&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;OR THIS:&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;...&lt;BR /&gt;if my-perl-script.pl arg1 arg1&lt;BR /&gt;then # further processing&lt;BR /&gt;print OK&lt;BR /&gt;else&lt;BR /&gt;exit $?&lt;BR /&gt;fi&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Tue, 29 Apr 2008 10:14:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/pass-the-return-status-of-perl-script-to-shell-script/m-p/4187925#M91232</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2008-04-29T10:14:08Z</dc:date>
    </item>
  </channel>
</rss>

