<?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: return value from shell function in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-shell-function/m-p/2700331#M932736</link>
    <description>Hi Leon,&lt;BR /&gt;Yes you can do that&lt;BR /&gt;&lt;BR /&gt;For example&lt;BR /&gt;&lt;BR /&gt;increment()&lt;BR /&gt;{&lt;BR /&gt;   sum='expr $1 + 1'&lt;BR /&gt;   return $sum&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;increment 5&lt;BR /&gt;echo $?&lt;BR /&gt;echo $sum&lt;BR /&gt;&lt;BR /&gt;Retun value is stored in $? also main script knows the variable $sum.&lt;BR /&gt;&lt;BR /&gt;Sachin Patel</description>
    <pubDate>Tue, 09 Apr 2002 19:39:49 GMT</pubDate>
    <dc:creator>Sachin Patel</dc:creator>
    <dc:date>2002-04-09T19:39:49Z</dc:date>
    <item>
      <title>return value from shell function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-shell-function/m-p/2700329#M932734</link>
      <description>Hi guys,&lt;BR /&gt;&lt;BR /&gt;Is it possible to return values within functions in the shell code?&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;function A &lt;BR /&gt;{&lt;BR /&gt;  retFromB = B &lt;BR /&gt;&lt;BR /&gt;  echo $retFromB //should display 5&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;function B&lt;BR /&gt;{&lt;BR /&gt;   i=5&lt;BR /&gt;&lt;BR /&gt;   return $i&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Thank you!</description>
      <pubDate>Tue, 09 Apr 2002 19:27:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-shell-function/m-p/2700329#M932734</guid>
      <dc:creator>andi_1</dc:creator>
      <dc:date>2002-04-09T19:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: return value from shell function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-shell-function/m-p/2700330#M932735</link>
      <description>Yes.  YOu could do something like:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;FuncA(){&lt;BR /&gt;FuncB&lt;BR /&gt;return $1&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;FuncB(){&lt;BR /&gt;return 5&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;FuncA&lt;BR /&gt;echo $?&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Apr 2002 19:38:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-shell-function/m-p/2700330#M932735</guid>
      <dc:creator>Tom Danzig</dc:creator>
      <dc:date>2002-04-09T19:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: return value from shell function</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-shell-function/m-p/2700331#M932736</link>
      <description>Hi Leon,&lt;BR /&gt;Yes you can do that&lt;BR /&gt;&lt;BR /&gt;For example&lt;BR /&gt;&lt;BR /&gt;increment()&lt;BR /&gt;{&lt;BR /&gt;   sum='expr $1 + 1'&lt;BR /&gt;   return $sum&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;increment 5&lt;BR /&gt;echo $?&lt;BR /&gt;echo $sum&lt;BR /&gt;&lt;BR /&gt;Retun value is stored in $? also main script knows the variable $sum.&lt;BR /&gt;&lt;BR /&gt;Sachin Patel</description>
      <pubDate>Tue, 09 Apr 2002 19:39:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/return-value-from-shell-function/m-p/2700331#M932736</guid>
      <dc:creator>Sachin Patel</dc:creator>
      <dc:date>2002-04-09T19:39:49Z</dc:date>
    </item>
  </channel>
</rss>

