<?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 script calling Csh script !! in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961762#M118441</link>
    <description>*ALL* scripts should start with the 'courtesy loader' directive so the shell will run the correct interpreter. For example:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/csh&lt;BR /&gt;...csh code...&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;&lt;BR /&gt;and so on. &lt;BR /&gt;&lt;BR /&gt;Note that there is only ONE return code for any process or script, the numeric value returned when it finishes (and accessible via $? in ksh or other POSIX shells). For additional values, the script must output these values as stdout or stderr and the calling script read these values.&lt;BR /&gt;&lt;BR /&gt;If the csh scripts change the environment by setting certain variables, these scripts must be rewritten to return the changes as stdout or stderr since executing a script in place (called 'sourcing' by using the dot . shell construct) requires the script to be written in the same language as the invoking shell (ksh in your case).</description>
    <pubDate>Tue, 29 Apr 2003 13:14:24 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2003-04-29T13:14:24Z</dc:date>
    <item>
      <title>Ksh script calling Csh script !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961758#M118437</link>
      <description>Hi there,&lt;BR /&gt;&lt;BR /&gt;Because of some political issue, I need to write a Ksh menu program to call some Csh scripts.....&lt;BR /&gt;&lt;BR /&gt;However, I have difficulties to get the return code returned by Csh..... &lt;BR /&gt;&lt;BR /&gt;Could anyone give me some examples for this question !&lt;BR /&gt;&lt;BR /&gt;Many thanks,&lt;BR /&gt;&lt;BR /&gt;Chris,</description>
      <pubDate>Tue, 29 Apr 2003 12:36:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961758#M118437</guid>
      <dc:creator>Chris Fung</dc:creator>
      <dc:date>2003-04-29T12:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Ksh script calling Csh script !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961759#M118438</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;I just tried out this -&lt;BR /&gt;&lt;BR /&gt;$ cat /tmp/a.sh&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;csh c.sh&lt;BR /&gt;if [[ $? -eq 0 ]]; then&lt;BR /&gt;echo "c.sh exited with 0 return value"&lt;BR /&gt;else&lt;BR /&gt;echo "c.sh exited with non-zero return value"&lt;BR /&gt;fi&lt;BR /&gt;# EOF&lt;BR /&gt;&lt;BR /&gt;$ cat /tmp/c.sh&lt;BR /&gt;#!/usr/bin/csh&lt;BR /&gt;exit 1&lt;BR /&gt;# EOF&lt;BR /&gt;&lt;BR /&gt;I am able to get the return values perfectly when i run a.sh with the call to c.sh as follows -&lt;BR /&gt;&lt;BR /&gt;/tmp/c.sh or csh /tmp/c.sh.&lt;BR /&gt;&lt;BR /&gt;It'd probably help if you could attach the scripts here.&lt;BR /&gt;&lt;BR /&gt;HTH.&lt;BR /&gt;&lt;BR /&gt;- ramd.</description>
      <pubDate>Tue, 29 Apr 2003 12:50:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961759#M118438</guid>
      <dc:creator>Ramkumar Devanathan</dc:creator>
      <dc:date>2003-04-29T12:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Ksh script calling Csh script !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961760#M118439</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;$? will return all exit codes.&lt;BR /&gt;&lt;BR /&gt;however if your c.sh script return more values such as variables.&lt;BR /&gt;&lt;BR /&gt;then you want to consider this&lt;BR /&gt;&lt;BR /&gt;c.sh | read LINE&lt;BR /&gt;&lt;BR /&gt;echo $LINE&lt;BR /&gt;&lt;BR /&gt;then you you can work from there.&lt;BR /&gt;&lt;BR /&gt;one of my c.sh scripts for instance return 18 variables.&lt;BR /&gt;&lt;BR /&gt;in ksh you can read them as &lt;BR /&gt;&lt;BR /&gt;c.sh | read VAR[0] VAR[1] ... VAR[17]&lt;BR /&gt;&lt;BR /&gt;echo $VAR[*] or echo $VAR[@]&lt;BR /&gt;&lt;BR /&gt;l8r&lt;BR /&gt;peace&lt;BR /&gt;Donny&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Apr 2003 13:01:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961760#M118439</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-04-29T13:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Ksh script calling Csh script !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961761#M118440</link>
      <description>Something not right here.  I don't believe you should be seeing this.&lt;BR /&gt;&lt;BR /&gt;'crontab' is csh for example.&lt;BR /&gt;&lt;BR /&gt;Got any lines in between the executing command and the test?&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;command1&lt;BR /&gt;STAT1=$?&lt;BR /&gt;&lt;BR /&gt;command2&lt;BR /&gt;STAT2=$?&lt;BR /&gt;&lt;BR /&gt;etc.</description>
      <pubDate>Tue, 29 Apr 2003 13:03:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961761#M118440</guid>
      <dc:creator>Michael Steele_2</dc:creator>
      <dc:date>2003-04-29T13:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Ksh script calling Csh script !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961762#M118441</link>
      <description>*ALL* scripts should start with the 'courtesy loader' directive so the shell will run the correct interpreter. For example:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/csh&lt;BR /&gt;...csh code...&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;#!/opt/perl/bin/perl&lt;BR /&gt;&lt;BR /&gt;and so on. &lt;BR /&gt;&lt;BR /&gt;Note that there is only ONE return code for any process or script, the numeric value returned when it finishes (and accessible via $? in ksh or other POSIX shells). For additional values, the script must output these values as stdout or stderr and the calling script read these values.&lt;BR /&gt;&lt;BR /&gt;If the csh scripts change the environment by setting certain variables, these scripts must be rewritten to return the changes as stdout or stderr since executing a script in place (called 'sourcing' by using the dot . shell construct) requires the script to be written in the same language as the invoking shell (ksh in your case).</description>
      <pubDate>Tue, 29 Apr 2003 13:14:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ksh-script-calling-csh-script/m-p/2961762#M118441</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-04-29T13:14:24Z</dc:date>
    </item>
  </channel>
</rss>

