gam@proper.UUCP (Gordon Moffett) (05/06/84)
# Anyone out there have a Bourne-shell-script to C-shell-script translator? I'm converting some sh scripts to csh and finding the process tediously mechanical. The reverse procedure would be nice, too, but I'm more concerned with the sh -> csh direction right now.
gwyn@brl-vgr.ARPA (Doug Gwyn ) (05/08/84)
It would be interesting to hear your reasons for taking Bourne shell scripts and translating them to the Cshell. Most people consider the Bourne shell to be the superior programming language for shell scripts. Not knocking you, you may have a perfectly valid reason; it's just that I can't think of any.. :-)
lcc.gm@UCLA-LOCUS.ARPA (05/11/84)
From: Greg McGary <lcc.gm@UCLA-LOCUS.ARPA> >> Anyone out there have a Bourne-shell-script to C-shell-script >> translator? I'm converting some sh scripts to csh and finding >> the process tediously mechanical. >> >> The reverse procedure would be nice, too, but I'm more concerned with >> the sh -> csh direction right now. My experience has been that csh(1) is practically useless for writing bullet-proofed, production shell programs. I think that csh wins hands-down as an *interactive* command interpreter because of history, aliases, and hashed command lookup; however, sh leaves csh in the dust when it comes to shell programming. Sh parses control constructs before executing them and allows redirection of output to and from them, and it handles signals in an intelligent and flexible manner. Csh treats control constructs as reserved commands and attempts to figure out what to do on the fly, and it has a very simple minded way of treating signals. Sh also starts up a heck of a lot faster than csh. I like to think of my login csh as the ``mother ship'' (and it really is a mother at times!) and my collection of sh programs as ``fighters'' that I can deploy to get something done. (Humor me, I've been here all night....) Don't let the ALGOL style syntax put you off, sh is a tremendously useful tool. For an excellent tutorial on writing programs in sh, pick up a copy of Kernighan and Pike's latest ``The Unix Programming Environment''. Avoid mechanical tedium today! Leave your bourne shell scripts as bourne shell scripts! --Greg-- PS: Sorry I didn't answer your query directly. Forgive me if you have already considered the merits of the two shells and have decided that you want to convert them anyway. If such is the case, I don't know of any translators. Personally, I usually choose to rewrite csh programs into sh by hand, since most csh beasties that must be rewritten are very poorly designed to begin with, so the task becomes re-design and re-implementation, rather than simply translation.