Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert from Korn shell to c shell

Status
Not open for further replies.

varocho

Programmer
Dec 4, 2000
238
US
Anyone know how to convert Korn shell scripts to c shell?
 
Hi,
Being a CSH programmer I will ask before you are SLAMMED by the KSH programmers in this forum.

Why would you want to convert your scripts?



that being said


I would suggest picking up the CSH MAN page and going through your script one line at a time and looking throught the MAN PAGE to see how to convert the line to the equivelent CSH.

Once you have done 10's or100's of conversions you should be fairly well versed in CSH.

If there is something specific you need to know how to do it post it here and if it isn't like your your home work assignement or something, the friendly people at tek-tips will probably help you.


there are thing that are very similiar in the scripts but just slightly different

if ( $a == 1 ) then
do something
endif

set a = "blort"

-------------------------

CSH is Significantly lacking is the READ capability.

in KSH
while read line <&4

I have found no good alternative for this in CSH. I have my work arounds.



 
I would also recommend looking at Chapter 3 of Unix in a Nutshell. It has a list of common features and differing features of the Bourne, Korn and C shells. The rest of the book would also probably be useful for something like this.

But you were probably looking for something a little more automated?
 
tdatgod, bi, thanks for responding.

tdatgod - I need to convert some scripts (related to printing and source code control) for other development teams that use the C shell.

bi - An automated process would be nice, but not necessary. This is an ongoing 'side' project I'm working on, and I'm actually looking forward to learning more about Unix. I'll probably pick up 'Unix in a Nutshell' this weekend.

 


Why not tell them to convert their scripts to KSH? :)

Like I said I perfere CSH personally but have learned to COPE in the SYS ADMIN world where everything is KSH.


In reality, there is no reason a KSH script can't call a CSH script and visa versa.

The only issue is exporting SCRIPT Variables externally to the calling program.

Why can't they just call your scripts directly?

 
I'd read this before heading towards csh

> for other development teams that use the C shell
If the scripts begin
Code:
#!/bin/ksh
They shouldn't need to know/care what they are written in.

The fact that they are written in ksh is less of a maintenance problem that having two 'bug incompatible' versions (one in ksh and one in csh) floating about the system.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top