<?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: Functions parameters in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/functions-parameters/m-p/4406672#M36244</link>
    <description>If you want the function to match how you're using it you need to echo instead of return.</description>
    <pubDate>Thu, 23 Apr 2009 15:38:03 GMT</pubDate>
    <dc:creator>Heironimus</dc:creator>
    <dc:date>2009-04-23T15:38:03Z</dc:date>
    <item>
      <title>Functions parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/functions-parameters/m-p/4406670#M36242</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;My function below must return $2 if $1 is null.&lt;BR /&gt;&lt;BR /&gt;nvl() {&lt;BR /&gt;&lt;BR /&gt;   if [[ $1 == "" ]]; then&lt;BR /&gt;      return $2&lt;BR /&gt;   else&lt;BR /&gt;      return $1&lt;BR /&gt;   fi&lt;BR /&gt;   &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;echo $(nvl $test "null")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;What is the correct syntax ?&lt;BR /&gt;&lt;BR /&gt;Bests Regards&lt;BR /&gt;Den&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Apr 2009 13:15:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/functions-parameters/m-p/4406670#M36242</guid>
      <dc:creator>Leo The Cat</dc:creator>
      <dc:date>2009-04-23T13:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Functions parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/functions-parameters/m-p/4406671#M36243</link>
      <description>&lt;!--!*#--&gt;&amp;gt; What is the correct syntax ?&lt;BR /&gt;&lt;BR /&gt;It depends on exactly what you're trying to&lt;BR /&gt;do.  Are you looking for something like this?&lt;BR /&gt;&lt;BR /&gt;bash$ nvl() {&lt;BR /&gt;&amp;gt;     if [ -z "$1" ]; then&lt;BR /&gt;&amp;gt;         return "$2";&lt;BR /&gt;&amp;gt;     else&lt;BR /&gt;&amp;gt;         return "$1";&lt;BR /&gt;&amp;gt;     fi&lt;BR /&gt;&amp;gt; }&lt;BR /&gt;&lt;BR /&gt;bash$ nvl 23 34 45&lt;BR /&gt;bash$ echo $?&lt;BR /&gt;23&lt;BR /&gt;&lt;BR /&gt;bash$ nvl '' 45 56&lt;BR /&gt;bash$ echo $?&lt;BR /&gt;45&lt;BR /&gt;&lt;BR /&gt;Is there some actual problem which you are&lt;BR /&gt;trying to solve?  Asking how to implement&lt;BR /&gt;some particular (bad) solution to a problem&lt;BR /&gt;may not be the best way to get a good&lt;BR /&gt;solution to that problem.</description>
      <pubDate>Thu, 23 Apr 2009 14:15:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/functions-parameters/m-p/4406671#M36243</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-04-23T14:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Functions parameters</title>
      <link>https://community.hpe.com/t5/operating-system-linux/functions-parameters/m-p/4406672#M36244</link>
      <description>If you want the function to match how you're using it you need to echo instead of return.</description>
      <pubDate>Thu, 23 Apr 2009 15:38:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/functions-parameters/m-p/4406672#M36244</guid>
      <dc:creator>Heironimus</dc:creator>
      <dc:date>2009-04-23T15:38:03Z</dc:date>
    </item>
  </channel>
</rss>

