<?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 within a script not working in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203768#M792816</link>
    <description>Thanks guys that's done it!</description>
    <pubDate>Thu, 26 Feb 2004 18:37:39 GMT</pubDate>
    <dc:creator>lawrenzo</dc:creator>
    <dc:date>2004-02-26T18:37:39Z</dc:date>
    <item>
      <title>Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203761#M792809</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Attached is a script which I am trying to verify the date entered DDMM has been entered correctly but I cannot get the sytax correct.&lt;BR /&gt;&lt;BR /&gt;please help&lt;BR /&gt;&lt;BR /&gt;thnx</description>
      <pubDate>Thu, 26 Feb 2004 18:08:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203761#M792809</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2004-02-26T18:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203762#M792810</link>
      <description>please note that I know there is a comment #&lt;BR /&gt;&lt;BR /&gt;ty</description>
      <pubDate>Thu, 26 Feb 2004 18:10:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203762#M792810</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2004-02-26T18:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203763#M792811</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;'date +%d%m' inside sed will be treated as a string. &lt;BR /&gt;&lt;BR /&gt;cat $i |sed s/'date +%d%m'/$SPFCHANGE/g &amp;gt;tmpfile&lt;BR /&gt;&lt;BR /&gt;Modify the above as follows&lt;BR /&gt;&lt;BR /&gt;DATE=$(date +%d%m)&lt;BR /&gt;sed 's/'${DATE}'/'$SPFCHANGE'/g' $i &amp;gt; tmpfile&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 26 Feb 2004 18:13:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203763#M792811</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-02-26T18:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203764#M792812</link>
      <description>sorry,&lt;BR /&gt;&lt;BR /&gt;I should have explained, the part that isn't working is the test to check the date (the commented line)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Feb 2004 18:15:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203764#M792812</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2004-02-26T18:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203765#M792813</link>
      <description>Hmmm.. I will use a case statement&lt;BR /&gt;&lt;BR /&gt;case $SPFCHANGE in&lt;BR /&gt;&lt;BR /&gt;[0-9][0-9][0-9][0-9]) call_your_function&lt;BR /&gt;&lt;BR /&gt;;;&lt;BR /&gt;&lt;BR /&gt;*) echo "There has been a problem changing the date, please check the date format" ; exit 1&lt;BR /&gt;;;&lt;BR /&gt;&lt;BR /&gt;esac&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Feb 2004 18:21:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203765#M792813</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-02-26T18:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203766#M792814</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;what about:&lt;BR /&gt;case $SPFCHANGE in&lt;BR /&gt; [0-9][0-9][0-9][0-9]) for i in ...&lt;BR /&gt; *) echo "There has been a problem changing the date, please check the date format" ;&lt;BR /&gt;    exit;;&lt;BR /&gt;esac</description>
      <pubDate>Thu, 26 Feb 2004 18:23:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203766#M792814</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-02-26T18:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203767#M792815</link>
      <description>And your sed is still incorrect. You will find it anyway while testing.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 26 Feb 2004 18:23:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203767#M792815</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-02-26T18:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203768#M792816</link>
      <description>Thanks guys that's done it!</description>
      <pubDate>Thu, 26 Feb 2004 18:37:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203768#M792816</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2004-02-26T18:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203769#M792817</link>
      <description>Here is one technique using awk's pattern matching&lt;BR /&gt;&lt;BR /&gt;OK=0&lt;BR /&gt;while [[ ${OK} -eq 0 ]]&lt;BR /&gt;  do &lt;BR /&gt;    echo "Please enter the date of the file you wish to transfer (DDMM): \c"&lt;BR /&gt;    read SPFCHANGE&lt;BR /&gt;    echo ${SPFCHANGE} | awk '{if ($0 ~ /^[0-9]{4}$/) exit(1); else exit(0)}'&lt;BR /&gt;    OK=${?}&lt;BR /&gt;    if [[ ${OK} -eq 0 ]]&lt;BR /&gt;      then&lt;BR /&gt;        echo "\aBad format; re-enter"&lt;BR /&gt;      fi&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Feb 2004 18:47:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203769#M792817</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-02-26T18:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203770#M792818</link>
      <description>brilliant, that's much better thanks Clay.</description>
      <pubDate>Thu, 26 Feb 2004 19:57:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203770#M792818</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2004-02-26T19:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Function within a script not working</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203771#M792819</link>
      <description>A modification to Clay's excellent script will do validation of the date.&lt;BR /&gt;&lt;BR /&gt;OK=0&lt;BR /&gt;typeset -i DD&lt;BR /&gt;typeset -i MM&lt;BR /&gt;while [[ ${OK} -eq 0 ]]&lt;BR /&gt;do&lt;BR /&gt;echo "Please enter the date of the file you wish to transfer (DDMM): \c"&lt;BR /&gt;read SPFCHANGE&lt;BR /&gt;echo ${SPFCHANGE} | awk '{if ($0 ~ /^[0-3][0-9][0-1][0-9]$/) exit(1); else exit(0)}'&lt;BR /&gt;OK=${?}&lt;BR /&gt;if [[ ${OK} -eq 0 ]]&lt;BR /&gt;then&lt;BR /&gt;echo "\aBad format; re-enter"&lt;BR /&gt;else&lt;BR /&gt;DD=`echo $SPFCHANGE | cut -c 1-2`&lt;BR /&gt;MM=`echo $SPFCHANGE | cut -c 3-4`&lt;BR /&gt;if [ ${DD} -gt 31 -o ${MM} -gt 12 ]&lt;BR /&gt;then&lt;BR /&gt;echo "\aBad format; re-enter"&lt;BR /&gt;OK=0&lt;BR /&gt;else&lt;BR /&gt;OK=1&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Mon, 01 Mar 2004 09:04:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/function-within-a-script-not-working/m-p/3203771#M792819</guid>
      <dc:creator>Arnold Hausmann</dc:creator>
      <dc:date>2004-03-01T09:04:50Z</dc:date>
    </item>
  </channel>
</rss>

