<?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: KSH to CSH conversion not working. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274604#M656916</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm seeing that your "if ($ck_user != 'oratst' )" sentence has no corresponding endif, in your case is comment.&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
    <pubDate>Tue, 22 Feb 2011 10:05:45 GMT</pubDate>
    <dc:creator>Jose Mosquera</dc:creator>
    <dc:date>2011-02-22T10:05:45Z</dc:date>
    <item>
      <title>KSH to CSH conversion not working.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274603#M656915</link>
      <description>Hi I have had to convert a ksh script which works to a csh script.&lt;BR /&gt;&lt;BR /&gt;the converted script is as below.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/csh&lt;BR /&gt;set +u&lt;BR /&gt;# Generic Start and stop for HP cluster Oracle DB's&lt;BR /&gt;# Parameters are $1 function  ... $2 DB Name&lt;BR /&gt;#&lt;BR /&gt;# First validate user is oratst&lt;BR /&gt;clear&lt;BR /&gt;set ck_user=`id | tr '(' " " | tr ')' " " | awk '{print $2}'`&lt;BR /&gt;if ($ck_user != 'oratst' ) then&lt;BR /&gt;echo 'ONLY user oratst can run this function    ... '$ck_user&lt;BR /&gt;echo '____________________________________'&lt;BR /&gt;echo '\nFirst login as oratst then try again '&lt;BR /&gt;sleep 2&lt;BR /&gt;#endif&lt;BR /&gt;#end&lt;BR /&gt;# Start or Stop function&lt;BR /&gt;case $1 in&lt;BR /&gt;start)  set DBFUNCTION='startup'&lt;BR /&gt;        set LSNFUNCTION='start';;&lt;BR /&gt;stop)   set DBFUNCTION='shutdown immediate'&lt;BR /&gt;        set LSNFUNCTION='stop';;&lt;BR /&gt;*)      echo 'Usage is .......... start  or stop  DB Name  '&lt;BR /&gt;        exit;;&lt;BR /&gt;esac&lt;BR /&gt;#Define DB and listener&lt;BR /&gt;case $2 in&lt;BR /&gt;TST)            set DBNAME='TST';set DB_LISTENER='TST';;&lt;BR /&gt;#smst)          DBNAME='smst';DB_LISTENER='smst';;&lt;BR /&gt;#medp_dba)      DBNAME='medp';DB_LISTENER='medp_dba';;&lt;BR /&gt;*)      echo 'only IALCH Databases smsm allowed'&lt;BR /&gt;        exit;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;ORACLE_SID=$DBNAME; export ORACLE_SID&lt;BR /&gt;echo 'Starting Listener now  '&lt;BR /&gt;/oracle/TST/102_64/bin/lsnrctl $LSNFUNCTION listener_${DB_LISTENER}&lt;BR /&gt;&lt;BR /&gt;sqlplus -s /nolog &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;connect / as sysdba&lt;BR /&gt;$DBFUNCTION&lt;BR /&gt;EOF&lt;BR /&gt;# End of script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;However i keep getting the error ./start_stop_SAPoraDB.sh[9]: Syntax error at line 9 : `if' is not matched.&lt;BR /&gt;&lt;BR /&gt;so i made a simpler script.&lt;BR /&gt;&lt;BR /&gt;#!/bin/csh&lt;BR /&gt;if ($#argv == 0) then&lt;BR /&gt;  echo "Proc arg missing"&lt;BR /&gt;endif&lt;BR /&gt;&lt;BR /&gt;and i get the error ./test2[2]: Syntax error at line 2 : `if' is not matched.&lt;BR /&gt;&lt;BR /&gt;why is this happening?&lt;BR /&gt; I have type csh and also su to the csh user with the same results.</description>
      <pubDate>Tue, 22 Feb 2011 09:44:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274603#M656915</guid>
      <dc:creator>wayne_104</dc:creator>
      <dc:date>2011-02-22T09:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: KSH to CSH conversion not working.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274604#M656916</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm seeing that your "if ($ck_user != 'oratst' )" sentence has no corresponding endif, in your case is comment.&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
      <pubDate>Tue, 22 Feb 2011 10:05:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274604#M656916</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2011-02-22T10:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: KSH to CSH conversion not working.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274605#M656917</link>
      <description>yea in desperation i commented it out.&lt;BR /&gt;&lt;BR /&gt;But same is happening with second script.</description>
      <pubDate>Tue, 22 Feb 2011 11:04:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274605#M656917</guid>
      <dc:creator>wayne_104</dc:creator>
      <dc:date>2011-02-22T11:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: KSH to CSH conversion not working.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274606#M656918</link>
      <description>&lt;!--!*#--&gt;Hi Wayne:&lt;BR /&gt;&lt;BR /&gt;You need to look at the Korn/Posix syntax.  A quick resource is this:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-90046/index.html" target="_blank"&gt;http://docs.hp.com/en/B2355-90046/index.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Here is a more formatted, Korn or Posix script:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;set +u&lt;BR /&gt;# Generic Start and stop for HP cluster Oracle DB's&lt;BR /&gt;# Parameters are $1 function ... $2 DB Name&lt;BR /&gt;#&lt;BR /&gt;# First validate user is oratst&lt;BR /&gt;clear&lt;BR /&gt;ck_user=$(id | tr '(' " " | tr ')' " " | awk '{print $2}')&lt;BR /&gt;if [ "$ck_user" != 'oratst' ]; then&lt;BR /&gt;    echo "ONLY user oratst can run this function ... $ck_user"&lt;BR /&gt;    echo "____________________________________"&lt;BR /&gt;    echo "\nFirst login as oratst then try again "&lt;BR /&gt;    sleep 2&lt;BR /&gt;fi&lt;BR /&gt;#&lt;BR /&gt;# Start or Stop function&lt;BR /&gt;case $1 in&lt;BR /&gt;    start)  DBFUNCTION='startup'&lt;BR /&gt;            LSNFUNCTION='start'&lt;BR /&gt;            ;;&lt;BR /&gt;    stop )  DBFUNCTION='shutdown immediate'&lt;BR /&gt;            LSNFUNCTION='stop'&lt;BR /&gt;            ;;&lt;BR /&gt;   *    )  echo 'Usage is .......... start or stop DB Name '&lt;BR /&gt;            exit&lt;BR /&gt;            ;;&lt;BR /&gt;esac&lt;BR /&gt;#Define DB and listener&lt;BR /&gt;case $2 in&lt;BR /&gt;    TST  )  DBNAME='TST'&lt;BR /&gt;            DB_LISTENER='TST'&lt;BR /&gt;            ;;&lt;BR /&gt;#   smst )  DBNAME='smst'&lt;BR /&gt;#           DB_LISTENER='smst'&lt;BR /&gt;#           ;;&lt;BR /&gt;#   medp_dba)&lt;BR /&gt;#           DBNAME='medp'&lt;BR /&gt;#           DB_LISTENER='medp_dba'&lt;BR /&gt;#           ;;&lt;BR /&gt;    *    ) echo 'only IALCH Databases smsm allowed'&lt;BR /&gt;           exit&lt;BR /&gt;           ;;&lt;BR /&gt;esac&lt;BR /&gt;export ORACLE_SID=$DBNAME&lt;BR /&gt;echo 'Starting Listener now '&lt;BR /&gt;/oracle/TST/102_64/bin/lsnrctl $LSNFUNCTION listener_${DB_LISTENER}&lt;BR /&gt;sqlplus -s /nolog &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;connect / as sysdba&lt;BR /&gt;$DBFUNCTION&lt;BR /&gt;EOF&lt;BR /&gt;# End of script&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 22 Feb 2011 13:39:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274606#M656918</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-22T13:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: KSH to CSH conversion not working.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274607#M656919</link>
      <description>Hi (again) Wayne:&lt;BR /&gt;&lt;BR /&gt;Well that was stupid, on my part :-(  You are trying to convert a working 'ksh' script to 'csh' not the other way around!&lt;BR /&gt;&lt;BR /&gt;First, why do you want to do this?  No matter what your default shell is, you can run scripts in any language.&lt;BR /&gt;&lt;BR /&gt;Second, you are trading a fairly robust shell ('ksh') for a broken, dysfunctional one in the form of 'csh'.  The C-shell is fine for very simple scripts and that's about all.  I urge you to read:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/" target="_blank"&gt;http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Feb 2011 13:44:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274607#M656919</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-22T13:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: KSH to CSH conversion not working.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274608#M656920</link>
      <description>Hi Because the damn sap consultant that get paid more than me said that is the shell that sap prefers.&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Feb 2011 13:48:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274608#M656920</guid>
      <dc:creator>wayne_104</dc:creator>
      <dc:date>2011-02-22T13:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: KSH to CSH conversion not working.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274609#M656921</link>
      <description>I have solved the problem.&lt;BR /&gt;&lt;BR /&gt;I usermod the sap user to ksh and my original script runs like a charm.&lt;BR /&gt;&lt;BR /&gt;Found a posting on the web that ksh is prefered to csh so sap consultant now has to explain.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Feb 2011 13:51:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274609#M656921</guid>
      <dc:creator>wayne_104</dc:creator>
      <dc:date>2011-02-22T13:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: KSH to CSH conversion not working.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274610#M656922</link>
      <description>&amp;gt;I usermod the sap user to ksh and my original script runs like a charm.&lt;BR /&gt;&lt;BR /&gt;As JRF said, you don't have to convert the user, just individual scripts.&lt;BR /&gt;The #! line determines the shell as long as it is executable.</description>
      <pubDate>Tue, 22 Feb 2011 19:08:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274610#M656922</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-02-22T19:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: KSH to CSH conversion not working.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274611#M656923</link>
      <description>Well the SAP consultant will probably reference SAP Note 202227, which does indeed recommend the csh shell as the login shell - you would have to ask SAP why they do this given the well-known issues with csh. The note talks about some issues with different implementations of ksh on different platforms, but to be honest I've never seen any serious issues with using ksh or even sh (the POSIX shell on HP-UX, not the bourne shell) with SAP.&lt;BR /&gt;&lt;BR /&gt;That said, this is a recommendation for the _login_ shell, not for what shell you write scripts in. As others have already indicated, you can still have csh as the login shell and then write scripts in ksh/sh as long as you have the appropriate #! entry on the first line of the script.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan</description>
      <pubDate>Wed, 23 Feb 2011 08:21:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-to-csh-conversion-not-working/m-p/5274611#M656923</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2011-02-23T08:21:02Z</dc:date>
    </item>
  </channel>
</rss>

