<?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: Making functions in Korn Shell . in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699189#M103237</link>
    <description>thank all .. i was refered to globar functions ..&lt;BR /&gt;&lt;BR /&gt;i don't know where use typeset -fu, autoload, FPATH,  ...&lt;BR /&gt;&lt;BR /&gt;Thanks, Manuales.</description>
    <pubDate>Wed, 28 Dec 2005 13:06:54 GMT</pubDate>
    <dc:creator>Manuales</dc:creator>
    <dc:date>2005-12-28T13:06:54Z</dc:date>
    <item>
      <title>Making functions in Korn Shell .</title>
      <link>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699185#M103233</link>
      <description>Hi ..&lt;BR /&gt;i need make many scripts, for that reasen i need make many functions ... i'm going to do them in korn shell.&lt;BR /&gt;I remember in profile it must have a variable called FPATH i do not remember how declare it, could you tell me sintaxis please?&lt;BR /&gt;&lt;BR /&gt;and, in this variable i know i have put the path where are going to be all functions, i remember only is necesary named the file like name function, is correct?&lt;BR /&gt;do i have make another thing?&lt;BR /&gt;do you know any manual o tutorial where it indicates how to create functions in korn shell?&lt;BR /&gt;&lt;BR /&gt;thanks!! Manuales.</description>
      <pubDate>Wed, 28 Dec 2005 12:27:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699185#M103233</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2005-12-28T12:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Making functions in Korn Shell .</title>
      <link>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699186#M103234</link>
      <description>&lt;BR /&gt;Functions are quite easy:&lt;BR /&gt;&lt;BR /&gt;# my function&lt;BR /&gt;function myfunction&lt;BR /&gt;{&lt;BR /&gt; add code here&lt;BR /&gt; exit&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;function print_hp&lt;BR /&gt;{&lt;BR /&gt;                Outpath=/var/spool/lp/receive&lt;BR /&gt;                PSMServer=prdprt&lt;BR /&gt;                # Strip path if any and take only filename&lt;BR /&gt;                Filename=`echo $F | sed 's/.*\///'`&lt;BR /&gt;                # Append filename to output file path&lt;BR /&gt;                Fileout=$Outpath/${Filename}&lt;BR /&gt;&lt;BR /&gt;                rcp $F ${PSMServer}:$Outpath&lt;BR /&gt;                rtc=$?&lt;BR /&gt;                if test "$rtc" != 0&lt;BR /&gt;                then&lt;BR /&gt;                echo "Cannot move $F to $Fileout"&lt;BR /&gt;                 echo "Cannot move $F to $Fileout" 1&amp;gt;&amp;amp;2&lt;BR /&gt;                 exit $rtc&lt;BR /&gt;                fi&lt;BR /&gt;                # -d&lt;DESTINATION&gt; -n&lt;COPIES&gt; -p&lt;PRIORITY&gt; -o&lt;NO banner=""&gt;&lt;BR /&gt;                remsh $PSMServer lp -d$P -n$C -p3 -onb $Fileout 1&amp;gt;&amp;amp;2&lt;BR /&gt;                rtc=$?&lt;BR /&gt;                if test "$rtc" != 0&lt;BR /&gt;                then&lt;BR /&gt;                  echo "petroprt returned error code $rtc"&lt;BR /&gt;                  echo "petroprt returned error code $rtc" 1&amp;gt;&amp;amp;2&lt;BR /&gt;                  exit $rtc&lt;BR /&gt;                fi&lt;BR /&gt;                rm -f $4&lt;BR /&gt;                #&lt;BR /&gt;                return ${rtc}&lt;BR /&gt;                         Status=$?&lt;BR /&gt;                         if test "$Status" != 0&lt;BR /&gt;                         then&lt;BR /&gt;                           echo "Cannot print $F to $P"&lt;BR /&gt;                           echo "Cannot print $F to $P" 1&amp;gt;&amp;amp;2&lt;BR /&gt;                           exit $Status&lt;BR /&gt;                         fi&lt;BR /&gt;                exit&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;/NO&gt;&lt;/PRIORITY&gt;&lt;/COPIES&gt;&lt;/DESTINATION&gt;</description>
      <pubDate>Wed, 28 Dec 2005 12:41:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699186#M103234</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2005-12-28T12:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Making functions in Korn Shell .</title>
      <link>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699187#M103235</link>
      <description>BTW - if the functions are to be used by many scripts, create a file called, say common.functions&lt;BR /&gt;&lt;BR /&gt;Then source it from your scripts:&lt;BR /&gt;&lt;BR /&gt;FUNC_FILE=/usr/local/common.functions&lt;BR /&gt;&lt;BR /&gt;# Source the files and functions&lt;BR /&gt;. $FUNC_FILE&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Wed, 28 Dec 2005 12:44:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699187#M103235</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2005-12-28T12:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Making functions in Korn Shell .</title>
      <link>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699188#M103236</link>
      <description>Hi Manuales:&lt;BR /&gt;&lt;BR /&gt;The manpages provide your first source of reference and answers:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.docs.hp.com/en/B2355-60103/ksh.1.html" target="_blank"&gt;http://www.docs.hp.com/en/B2355-60103/ksh.1.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The Shell Users Guide is also a useful reference:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.docs.hp.com/en/B2355-90046/B2355-90046.pdf" target="_blank"&gt;http://www.docs.hp.com/en/B2355-90046/B2355-90046.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 28 Dec 2005 12:47:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699188#M103236</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-28T12:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Making functions in Korn Shell .</title>
      <link>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699189#M103237</link>
      <description>thank all .. i was refered to globar functions ..&lt;BR /&gt;&lt;BR /&gt;i don't know where use typeset -fu, autoload, FPATH,  ...&lt;BR /&gt;&lt;BR /&gt;Thanks, Manuales.</description>
      <pubDate>Wed, 28 Dec 2005 13:06:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699189#M103237</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2005-12-28T13:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Making functions in Korn Shell .</title>
      <link>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699190#M103238</link>
      <description>FPATH should be set in the script - not exported.&lt;BR /&gt;&lt;BR /&gt;THere is an interesting thread about ksh scripting here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.exforsys.com/forum/showthread.php?t=81773" target="_blank"&gt;http://www.exforsys.com/forum/showthread.php?t=81773&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Particulary, the rather long (but informative) post by Dan Mercer...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Wed, 28 Dec 2005 13:13:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699190#M103238</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2005-12-28T13:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Making functions in Korn Shell .</title>
      <link>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699191#M103239</link>
      <description>Hi all!!&lt;BR /&gt;i have the solution:&lt;BR /&gt;&lt;BR /&gt;1st step:&lt;BR /&gt;in .profile file put:&lt;BR /&gt;FPATH=/.../../FUNCTIONS/&lt;BR /&gt;typeset -fu function_one&lt;BR /&gt;typeset -fu function_two&lt;BR /&gt;typeset -fu function_three&lt;BR /&gt;....&lt;BR /&gt;....&lt;BR /&gt;....&lt;BR /&gt;typeset -fu function_"n"&lt;BR /&gt;&lt;BR /&gt;then, in path /.../../FUNCTION create new file, the name of this file must be same name in the function, for exammple:&lt;BR /&gt;&lt;BR /&gt;======================&lt;BR /&gt;cat &amp;gt; function_one&lt;BR /&gt;function function_one&lt;BR /&gt;{&lt;BR /&gt;echo "Hi, this is a test"&lt;BR /&gt;}&lt;BR /&gt;ctrl + c&lt;BR /&gt;&lt;BR /&gt;more function_one&lt;BR /&gt;function function_one&lt;BR /&gt;{&lt;BR /&gt;echo "Hi, this is a test"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;======================&lt;BR /&gt;then since other file you must invoke it, for example, in a file named "verificando"&lt;BR /&gt;&lt;BR /&gt;cat &amp;gt; verificando&lt;BR /&gt;#(1st step done)&lt;BR /&gt;. $HOME/.../../FUNCTIONS/.profile&lt;BR /&gt;functione_one&lt;BR /&gt;&lt;BR /&gt;ctrl+c&lt;BR /&gt;&lt;BR /&gt;cat verificando:&lt;BR /&gt;#(1st step done)&lt;BR /&gt;. $HOME/.../../FUNCTIONS/.profile&lt;BR /&gt;functione_one&lt;BR /&gt;&lt;BR /&gt;Running script:&lt;BR /&gt;unix&amp;gt; ./verificando&lt;BR /&gt;Hi, this is a test&lt;BR /&gt;&lt;BR /&gt;Thanks friends !!!&lt;BR /&gt;Manuales &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Dec 2005 13:37:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/making-functions-in-korn-shell/m-p/3699191#M103239</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2005-12-28T13:37:06Z</dc:date>
    </item>
  </channel>
</rss>

