how to run ksh from csh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to run ksh from csh
# 1  
Old 09-03-2008
how to run ksh from csh

I'm comfortable with csh. However, i need to run a ksh script.Using exec /bin/ksh -i , I'm able to invoke ksh, but the script is not running any further. Variable QDDTS is an env setting on my csh env.
The ksh script goes like this -

#!/bin/csh

exec /usr/local/bin/ksh -i

function prepbuglist
{
print "Running prepreport "$1 $startday $today

$QDDTS/bin/query.pl "Project:ABC and Product:xyz and Severity:1,2,3,4,5" > /tmp/all-rn.bugs
# 2  
Old 09-03-2008
First, this is a wrong approach. On the first line, put:

Code:
#!/usr/local/bin/ksh

Second, I think your script is not complete. You need to put the closing brace } somewhere, either before or after the line starting with QDDTS (depending on whether that is also part of the function).
# 3  
Old 09-03-2008
Thanks for your input.
I agree to your point that the script is not complete, so the braces are not closed. I've pasted about 5% of the script.
However, with #!/usr/local/bin/ksh the issue I'm facing is - It's not able to take value of QDDTS from env settings. env settings (in csh, has value of QDDTS set to a path like "/usr/local/bin/...")
Please let me know your thoughts.
# 4  
Old 09-03-2008
All variables from the environment are available to the KSH script. If it's not getting there, it could be a problem with how the variable is exported or with the /etc/kshrc or .kshrc files. In CSH, make sure you export your variable this way:

Code:
setenv QDDTS $QDDTS
env | grep QDDTS
ksh -c env |grep QDDTS

Do you get two lines of QDDTS=..... ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to run a file in a csh script?

Hi, I have a csh script. I want to set some variables and execute some command from a file in that script. abc.csh echo "primary script" b setenv XXX ddd set XX make abc I want to execute the commands of "b" file from abc.csh. How can i do that. Please view this link: How to use... (3 Replies)
Discussion started by: vdhingra123
3 Replies

2. Shell Programming and Scripting

Translate csh to ksh

Hi! I need to translate those line in csh (to initialise variable) into ksh construct. Any help would be appreciated! I don't know how to replace them :( Thanks Hulu setenv TestHul "$0 $*" setenv JG `setenvp "JG" "" "$*"` setenv A_1 `setenvp "A_1" "NA" "$*"` Please use next time... (2 Replies)
Discussion started by: patator67
2 Replies

3. Shell Programming and Scripting

ksh equivalent to >& in csh

In csh I am using >&. What is the equivalent in ksh?? >& - redirect stdout and stderr (csh,tcsh) (18 Replies)
Discussion started by: kristinu
18 Replies

4. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

5. Shell Programming and Scripting

csh has function -x as ksh ?

Dear All, Normally, I use ksh to code script but I got a new assignment to check the error code of csh so I want to know csh has fuction -x(/bin/ksh -x) as ksh or not? If csh has, which mode? Another way, how can I check it my code is correctly? Thank in advance (2 Replies)
Discussion started by: unitipon
2 Replies

6. Shell Programming and Scripting

calling csh script from ksh shell

hi, I have a csh script, which has setenv X xyz etc My shell is korn Is there some way I can "source" this to have the variables in my current korn shell? thanks (3 Replies)
Discussion started by: JamesByars
3 Replies

7. UNIX for Dummies Questions & Answers

Csh Vs Ksh

I created a simple script and attempted to run it. All that the scrip contained was "ls -l". At first I received the message "ksh: run_dir: not found" I then tried typing "csh run_dir" This time the script worked. typing echo $SHELL produced /bin/ksh I would like to understand why this... (4 Replies)
Discussion started by: SUSANR9999
4 Replies

8. Shell Programming and Scripting

csh -> ksh conversion question

Having been a long-time csh person I now need to convert a lot of stuff to run under ksh. Can anyone tell me how to do a ksh equivalent of the csh history substitution !* that can be used in an alias, ie how would I do: alias cd "cd \!*; pwd" alias find "find . -name... (2 Replies)
Discussion started by: jonnywilkins
2 Replies

9. Shell Programming and Scripting

\!* in csh what is it for ksh

Hey guys, Hopefully a simple question for you. In csh I have an alias that looks like: alias ff 'find . -name \!* -print' and can therefore perform a search for a file by typing: ff filename The same comand does not work in ksh alias ff="find . -name \!* -print" I get: find:... (3 Replies)
Discussion started by: timsk
3 Replies

10. UNIX for Dummies Questions & Answers

switch from csh to ksh

My UNIX SA requires that we start in CSH. I like to use KSH because most of my experience is in that shell. I added ksh to the end of my .login script which does take me into KSH but I would like to automatically execute my .profile to setup my aliases. I cannot use a .shell file because I... (1 Reply)
Discussion started by: veeracer
1 Replies
Login or Register to Ask a Question