<?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: Function call in script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/function-call-in-script/m-p/2636698#M42562</link>
    <description>Hello Darrell,&lt;BR /&gt;&lt;BR /&gt;Thank you for that.  Your suggestion worked just fine.&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;Sanjay</description>
    <pubDate>Sat, 29 Dec 2001 17:38:22 GMT</pubDate>
    <dc:creator>Sanjay Tailor</dc:creator>
    <dc:date>2001-12-29T17:38:22Z</dc:date>
    <item>
      <title>Function call in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-call-in-script/m-p/2636696#M42560</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;I am writing a script that requires the user to input 3 variables.  To make the program more robust, I want to check each variable just to see if anything has been entered.  If nothing has been entered the user is prompted to enter again.&lt;BR /&gt;&lt;BR /&gt;Instead of writing the same script piece 3 times, my thinking was to write a function that would check to see if anything had been entered.&lt;BR /&gt;&lt;BR /&gt;My problem is: How can I call the function 3 times with 3 different variables and have it return the correct variables?  I have attached the program as it stands and so far I have it checking the 1st variable.  I want to use the same function to check all  3 variables.&lt;BR /&gt;&lt;BR /&gt;Thank you. &lt;BR /&gt;Sanjay&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 29 Dec 2001 15:17:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-call-in-script/m-p/2636696#M42560</guid>
      <dc:creator>Sanjay Tailor</dc:creator>
      <dc:date>2001-12-29T15:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Function call in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-call-in-script/m-p/2636697#M42561</link>
      <description>Hi Sanjay,&lt;BR /&gt;&lt;BR /&gt;I'm not a script guru but you could do something like this:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;#&lt;BR /&gt;function checknum&lt;BR /&gt;{&lt;BR /&gt;echo "Enter "$PROMPT": \c"&lt;BR /&gt;read VAR&lt;BR /&gt;while [ "$VAR" = "" ]&lt;BR /&gt;do&lt;BR /&gt;echo "You must enter "$PROMPT" (Ctrl-C to quit)\n"&lt;BR /&gt;echo "Enter "$PROMPT": \c"&lt;BR /&gt;read VAR&lt;BR /&gt;done&lt;BR /&gt;}&lt;BR /&gt;#&lt;BR /&gt;PROMPT="Input base"&lt;BR /&gt;checknum&lt;BR /&gt;ib=$VAR&lt;BR /&gt;#&lt;BR /&gt;PROMPT="Output base"&lt;BR /&gt;checknum&lt;BR /&gt;ob=$VAR&lt;BR /&gt;#&lt;BR /&gt;PROMPT="Number to convert"&lt;BR /&gt;checknum&lt;BR /&gt;newin=$VAR&lt;BR /&gt;#&lt;BR /&gt;echo Input base: $ib&lt;BR /&gt;echo Output base: $ob&lt;BR /&gt;echo Number to convert: $newin&lt;BR /&gt;&lt;BR /&gt;Darrell</description>
      <pubDate>Sat, 29 Dec 2001 17:04:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-call-in-script/m-p/2636697#M42561</guid>
      <dc:creator>Darrell Allen</dc:creator>
      <dc:date>2001-12-29T17:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Function call in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-call-in-script/m-p/2636698#M42562</link>
      <description>Hello Darrell,&lt;BR /&gt;&lt;BR /&gt;Thank you for that.  Your suggestion worked just fine.&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;Sanjay</description>
      <pubDate>Sat, 29 Dec 2001 17:38:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-call-in-script/m-p/2636698#M42562</guid>
      <dc:creator>Sanjay Tailor</dc:creator>
      <dc:date>2001-12-29T17:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Function call in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-call-in-script/m-p/2636699#M42563</link>
      <description>You can call a function with values. They work just like running a script:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;function TestParams&lt;BR /&gt;{&lt;BR /&gt;echo "$# params, 1=$1, 2=$2, all=$@"&lt;BR /&gt;return&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;TestParams 1 2 3 4 5 &lt;BR /&gt;TestParams 123 456&lt;BR /&gt;&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;Now to pass a parameter and modify the value, the easiest is to export the parameter at the start of the script. Now, all functions will know about this parameter and it won't have to be passed to the function in the call.</description>
      <pubDate>Sun, 30 Dec 2001 04:00:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-call-in-script/m-p/2636699#M42563</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2001-12-30T04:00:36Z</dc:date>
    </item>
  </channel>
</rss>

