<?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: invoking a function with parameter in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093616#M7232</link>
    <description>quick question - quick answer. thanks a lot guys.</description>
    <pubDate>Wed, 15 Oct 2003 04:02:46 GMT</pubDate>
    <dc:creator>Maciej Szewczykowski</dc:creator>
    <dc:date>2003-10-15T04:02:46Z</dc:date>
    <item>
      <title>invoking a function with parameter</title>
      <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093611#M7227</link>
      <description>hi all. &lt;BR /&gt;how to invoke a function so it takes certain values as parameters?&lt;BR /&gt;the point is: i've got a function that work with two variables (v1, v2). i'd like to make it work each time with different values of these variables. where should the function take values from (command line? file?) &lt;BR /&gt;how to make it work?&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Oct 2003 03:46:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093611#M7227</guid>
      <dc:creator>Maciej Szewczykowski</dc:creator>
      <dc:date>2003-10-15T03:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: invoking a function with parameter</title>
      <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093612#M7228</link>
      <description>Lets assume you mean a shell script for the moment.  When you call the function, just use your values as arguments and within the function reference them as $1 $2 etc etc.&lt;BR /&gt; &lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Oct 2003 03:49:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093612#M7228</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-15T03:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: invoking a function with parameter</title>
      <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093613#M7229</link>
      <description>Mark, could you please write a short example? (i mean how to send values to the function)</description>
      <pubDate>Wed, 15 Oct 2003 03:53:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093613#M7229</guid>
      <dc:creator>Maciej Szewczykowski</dc:creator>
      <dc:date>2003-10-15T03:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: invoking a function with parameter</title>
      <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093614#M7230</link>
      <description>function myecho {&lt;BR /&gt;        echo $1&lt;BR /&gt;}&lt;BR /&gt;  &lt;BR /&gt;myecho hello&lt;BR /&gt;exit&lt;BR /&gt; &lt;BR /&gt;I don't know if you can prototype functions so its safer to just declare the functions first.</description>
      <pubDate>Wed, 15 Oct 2003 03:59:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093614#M7230</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-15T03:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: invoking a function with parameter</title>
      <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093615#M7231</link>
      <description>Write :&lt;BR /&gt;v1=3&lt;BR /&gt;v2=7&lt;BR /&gt;echo $v1&lt;BR /&gt;3&lt;BR /&gt;echo $v2&lt;BR /&gt;7&lt;BR /&gt;&lt;BR /&gt;hth&lt;BR /&gt;&lt;BR /&gt;J</description>
      <pubDate>Wed, 15 Oct 2003 04:00:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093615#M7231</guid>
      <dc:creator>Jerome Henry</dc:creator>
      <dc:date>2003-10-15T04:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: invoking a function with parameter</title>
      <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093616#M7232</link>
      <description>quick question - quick answer. thanks a lot guys.</description>
      <pubDate>Wed, 15 Oct 2003 04:02:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093616#M7232</guid>
      <dc:creator>Maciej Szewczykowski</dc:creator>
      <dc:date>2003-10-15T04:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: invoking a function with parameter</title>
      <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093617#M7233</link>
      <description>Didn't you ask this yesterday in the HP forums ??&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=233360" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=233360&lt;/A&gt;&lt;BR /&gt;--&lt;BR /&gt;Anyway, within the function, just refer to $1, $2 as your parameters, and call it using syntax "yourfunc p1, p2".&lt;BR /&gt;Example: function leave takes an optional single parameter&lt;BR /&gt;--&lt;BR /&gt;function leave {&lt;BR /&gt;  [ -n "$1" ]   &amp;amp;&amp;amp; exit_cd=$1&lt;BR /&gt;  exit $exit_cd&lt;BR /&gt;  }&lt;BR /&gt;-- and can be called in 2 ways --&lt;BR /&gt;        leave 1&lt;BR /&gt;        leave &lt;BR /&gt;--&lt;BR /&gt;--Graham&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Oct 2003 04:04:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093617#M7233</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-15T04:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: invoking a function with parameter</title>
      <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093618#M7234</link>
      <description>And another, just to show some looping&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;function addten {&lt;BR /&gt; b=`expr $1 + 10`&lt;BR /&gt; echo "$1 plus 10 is $b"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;for i in 10 23 4 65&lt;BR /&gt;do&lt;BR /&gt; addten $i&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Oct 2003 04:10:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093618#M7234</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-15T04:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: invoking a function with parameter</title>
      <link>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093619#M7235</link>
      <description>that's right. thank you once more.</description>
      <pubDate>Wed, 15 Oct 2003 04:20:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/invoking-a-function-with-parameter/m-p/3093619#M7235</guid>
      <dc:creator>Maciej Szewczykowski</dc:creator>
      <dc:date>2003-10-15T04:20:52Z</dc:date>
    </item>
  </channel>
</rss>

